Wednesday, 15 May 2019. (#35448)

1. Add vue2-editor types.
This commit is contained in:
I Komang Suryadana 2019-05-15 04:56:47 +07:00 committed by Nathan Shively-Sanders
parent 500da47fe5
commit 069ae6d491
5 changed files with 123 additions and 0 deletions

55
types/vue2-editor/index.d.ts vendored Normal file
View File

@ -0,0 +1,55 @@
// Type definitions for vue-tel-input 2.6
// Project: https://github.com/davidroyer/vue2-editor/#readme
// Definitions by: Komang Suryadana <https://github.com/suryadana>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { VueConstructor } from 'vue';
import { DirectiveOptions } from 'vue/types/options';
export default VueEditor;
export const VueEditor: VueEditorConstructor;
export interface VueEditorProps {
id: string;
placeholder: string;
value: string;
disabled: boolean;
editorToolbar: any[];
editorOptions: any;
useCustomImageHandler: any;
useMarkdownShortcuts: boolean;
}
export interface VueEditorData {
quill: any;
}
export interface VueEditorWatch {
value: (val: any) => void;
disabled: (status: boolean) => void;
}
export interface VueEditorMethods {
initializeEditor: () => void;
setupQuillEditor: () => void;
setModules: () => void;
prepareEditorConfig: (editorConfig: any) => void;
registerPrototypes: () => void;
registerEditorEventListeners: () => void;
listenForEditorEvent: (type: any) => void;
handleInitialContent: () => void;
handleSelectionChange: (range: any, oldRange: any) => void;
handleTextChange: () => void;
checkForCustomImageHandler: () => void;
setupCustomImageHandler: () => void;
customImageHandler: (image: any, callback: any) => void;
emitImageInfo: ($event: Event) => void;
}
export interface VueEditorConstructor extends VueConstructor {
props: VueEditorProps;
data: () => VueEditorData;
watch: VueEditorWatch;
methods: VueEditorMethods;
}

View File

@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"vue": ">=2.0.0"
}
}

View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"vue2-editor-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -0,0 +1,37 @@
import Vue from 'vue';
import { VueEditor } from 'vue2-editor';
new Vue({
el: '#app',
data: {
phone: "",
bindProps: {
defaultCountry: "",
disabledFetchingCountry: false,
disabled: false,
disabledFormatting: false,
placeholder: "Enter a phone number",
required: false,
enabledCountryCode: false,
enabledFlags: true,
preferredCountries: ["AU", "BR"],
onlyCountries: [],
ignoredCountries: [],
autocomplete: "off",
name: "telephone",
maxLen: 25,
wrapperClasses: "",
inputClasses: "",
dropdownOptions: {
disabledDialCode: false
},
inputOptions: {
showDialCode: false
}
}
},
components: {
VueEditor,
},
template: `<vue-editor v-model="content"></vue-editor>`
});