@morfira-dev/wysiwyg-vue 1.5.2 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +19 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
|
-
import type { EditorPlugin } from '@morfira-dev/wysiwyg-core';
|
|
2
|
+
import type { EditorPlugin, EditorTranslations } from '@morfira-dev/wysiwyg-core';
|
|
3
3
|
export declare const MorfiraEditor: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
4
|
modelValue: {
|
|
5
5
|
type: StringConstructor;
|
|
@@ -8,6 +8,14 @@ export declare const MorfiraEditor: import("vue").DefineComponent<import("vue").
|
|
|
8
8
|
readOnly: BooleanConstructor;
|
|
9
9
|
placeholder: StringConstructor;
|
|
10
10
|
label: StringConstructor;
|
|
11
|
+
locale: {
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
default: string;
|
|
14
|
+
};
|
|
15
|
+
translations: {
|
|
16
|
+
type: PropType<EditorTranslations>;
|
|
17
|
+
default: () => {};
|
|
18
|
+
};
|
|
11
19
|
plugins: {
|
|
12
20
|
type: PropType<EditorPlugin[]>;
|
|
13
21
|
default: () => never[];
|
|
@@ -22,6 +30,14 @@ export declare const MorfiraEditor: import("vue").DefineComponent<import("vue").
|
|
|
22
30
|
readOnly: BooleanConstructor;
|
|
23
31
|
placeholder: StringConstructor;
|
|
24
32
|
label: StringConstructor;
|
|
33
|
+
locale: {
|
|
34
|
+
type: StringConstructor;
|
|
35
|
+
default: string;
|
|
36
|
+
};
|
|
37
|
+
translations: {
|
|
38
|
+
type: PropType<EditorTranslations>;
|
|
39
|
+
default: () => {};
|
|
40
|
+
};
|
|
25
41
|
plugins: {
|
|
26
42
|
type: PropType<EditorPlugin[]>;
|
|
27
43
|
default: () => never[];
|
|
@@ -33,5 +49,7 @@ export declare const MorfiraEditor: import("vue").DefineComponent<import("vue").
|
|
|
33
49
|
}>, {
|
|
34
50
|
readOnly: boolean;
|
|
35
51
|
modelValue: string;
|
|
52
|
+
locale: string;
|
|
53
|
+
translations: Readonly<Record<string, string>>;
|
|
36
54
|
plugins: EditorPlugin[];
|
|
37
55
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{defineComponent as
|
|
1
|
+
import{defineComponent as u,h as s,onBeforeUnmount as y,onMounted as f,ref as m,watch as o}from"vue";import{createEditor as c}from"@morfira-dev/wysiwyg-core";var E=u({name:"MorfiraEditor",props:{modelValue:{type:String,default:""},readOnly:Boolean,placeholder:String,label:String,locale:{type:String,default:"ru"},translations:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]}},emits:["update:modelValue","change","ready"],setup:(e,{emit:a,expose:d})=>{let n=m(),t,r=!1;return f(()=>{t=c(n.value,{value:e.modelValue,readOnly:e.readOnly,placeholder:e.placeholder,label:e.label,plugins:e.plugins,locale:e.locale,translations:e.translations,onChange:l=>{r||(a("update:modelValue",l.html),a("change",l))}}),a("ready",t)}),o(()=>e.modelValue,l=>{if(!(!t||l===t.getHTML())){r=!0;try{t.setHTML(l)}finally{r=!1}}}),o(()=>e.readOnly,l=>t?.setReadOnly(l)),o(()=>[e.locale,e.translations],([l,i])=>t?.setLocale(l,i),{deep:!0}),y(()=>t?.destroy()),d({getEditor:()=>t}),()=>s("div",{ref:n,class:"mw-host"})}});export{E as MorfiraEditor};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { defineComponent, h, onBeforeUnmount, onMounted, ref, watch } from 'vue';\nimport type { PropType } from 'vue';\nimport { createEditor } from '@morfira-dev/wysiwyg-core';\nimport type { Editor, EditorPlugin } from '@morfira-dev/wysiwyg-core';\n\nexport const MorfiraEditor = defineComponent({\n name: 'MorfiraEditor',\n props: {\n modelValue: { type: String, default: '' },\n readOnly: Boolean,\n placeholder: String,\n label: String,\n plugins: { type: Array as PropType<EditorPlugin[]>, default: () => [] },\n },\n emits: ['update:modelValue', 'change', 'ready'],\n setup: (props, { emit, expose }) => {\n const host = ref<HTMLElement>();\n let editor: Editor | undefined;\n let applying = false;\n onMounted(() => {\n editor = createEditor(host.value!, {\n value: props.modelValue, readOnly: props.readOnly, placeholder: props.placeholder, label: props.label, plugins: props.plugins,\n onChange: (change) => {\n if (!applying) {\n emit('update:modelValue', change.html);\n emit('change', change);\n }\n },\n });\n emit('ready', editor);\n });\n watch(() => props.modelValue, (value) => {\n if (!editor || value === editor.getHTML())\n return;\n applying = true;\n try {\n editor.setHTML(value);\n }\n finally {\n applying = false;\n }\n });\n watch(() => props.readOnly, (value) => editor?.setReadOnly(value));\n onBeforeUnmount(() => editor?.destroy());\n expose({ getEditor: () => editor });\n return () => h('div', { ref: host, class: 'mw-host' });\n },\n});\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,mBAAAA,EAAiB,KAAAC,EAAG,mBAAAC,EAAiB,aAAAC,EAAW,OAAAC,EAAK,SAAAC,MAAa,MAE3E,OAAS,gBAAAC,MAAoB,4BAGtB,IAAMC,EAAgBP,EAAgB,CAC3C,KAAM,gBACN,MAAO,CACL,WAAY,CAAE,KAAM,OAAQ,QAAS,EAAG,EACxC,SAAU,QACV,YAAa,OACb,MAAO,OACP,QAAS,CAAE,KAAM,MAAmC,QAAS,IAAM,CAAC,CAAE,CACxE,EACA,MAAO,CAAC,oBAAqB,SAAU,OAAO,EAC9C,MAAO,CAACQ,EAAO,CAAE,KAAAC,EAAM,OAAAC,CAAO,IAAM,CAClC,IAAMC,EAAOP,EAAiB,EAC1BQ,EACAC,EAAW,GACf,OAAAV,EAAU,IAAM,CACdS,EAASN,EAAaK,EAAK,MAAQ,CACjC,MAAOH,EAAM,WAAY,SAAUA,EAAM,SAAU,YAAaA,EAAM,YAAa,MAAOA,EAAM,MAAO,QAASA,EAAM,QACtH,SAAWM,GAAW,CACfD,IACHJ,EAAK,oBAAqBK,EAAO,IAAI,EACrCL,EAAK,SAAUK,CAAM,EAEzB,CACF,CAAC,EACDL,EAAK,QAASG,CAAM,CACtB,CAAC,EACDP,EAAM,IAAMG,EAAM,WAAaO,GAAU,CACvC,GAAI,GAACH,GAAUG,IAAUH,EAAO,QAAQ,GAExC,CAAAC,EAAW,GACX,GAAI,CACFD,EAAO,QAAQG,CAAK,CACtB,QACA,CACEF,EAAW,EACb,EACF,CAAC,EACDR,EAAM,IAAMG,EAAM,SAAWO,GAAUH,GAAQ,YAAYG,CAAK,CAAC,
|
|
6
|
-
"names": ["defineComponent", "h", "onBeforeUnmount", "onMounted", "ref", "watch", "createEditor", "MorfiraEditor", "props", "emit", "expose", "host", "editor", "applying", "change", "value"]
|
|
4
|
+
"sourcesContent": ["import { defineComponent, h, onBeforeUnmount, onMounted, ref, watch } from 'vue';\nimport type { PropType } from 'vue';\nimport { createEditor } from '@morfira-dev/wysiwyg-core';\nimport type { Editor, EditorPlugin, EditorTranslations } from '@morfira-dev/wysiwyg-core';\n\nexport const MorfiraEditor = defineComponent({\n name: 'MorfiraEditor',\n props: {\n modelValue: { type: String, default: '' },\n readOnly: Boolean,\n placeholder: String,\n label: String,\n locale: { type: String, default: 'ru' },\n translations: { type: Object as PropType<EditorTranslations>, default: () => ({}) },\n plugins: { type: Array as PropType<EditorPlugin[]>, default: () => [] },\n },\n emits: ['update:modelValue', 'change', 'ready'],\n setup: (props, { emit, expose }) => {\n const host = ref<HTMLElement>();\n let editor: Editor | undefined;\n let applying = false;\n onMounted(() => {\n editor = createEditor(host.value!, {\n value: props.modelValue, readOnly: props.readOnly, placeholder: props.placeholder, label: props.label, plugins: props.plugins,\n locale: props.locale, translations: props.translations,\n onChange: (change) => {\n if (!applying) {\n emit('update:modelValue', change.html);\n emit('change', change);\n }\n },\n });\n emit('ready', editor);\n });\n watch(() => props.modelValue, (value) => {\n if (!editor || value === editor.getHTML())\n return;\n applying = true;\n try {\n editor.setHTML(value);\n }\n finally {\n applying = false;\n }\n });\n watch(() => props.readOnly, (value) => editor?.setReadOnly(value));\n watch(() => [props.locale, props.translations] as const, ([locale, translations]) => editor?.setLocale(locale, translations), { deep: true });\n onBeforeUnmount(() => editor?.destroy());\n expose({ getEditor: () => editor });\n return () => h('div', { ref: host, class: 'mw-host' });\n },\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,mBAAAA,EAAiB,KAAAC,EAAG,mBAAAC,EAAiB,aAAAC,EAAW,OAAAC,EAAK,SAAAC,MAAa,MAE3E,OAAS,gBAAAC,MAAoB,4BAGtB,IAAMC,EAAgBP,EAAgB,CAC3C,KAAM,gBACN,MAAO,CACL,WAAY,CAAE,KAAM,OAAQ,QAAS,EAAG,EACxC,SAAU,QACV,YAAa,OACb,MAAO,OACP,OAAQ,CAAE,KAAM,OAAQ,QAAS,IAAK,EACtC,aAAc,CAAE,KAAM,OAAwC,QAAS,KAAO,CAAC,EAAG,EAClF,QAAS,CAAE,KAAM,MAAmC,QAAS,IAAM,CAAC,CAAE,CACxE,EACA,MAAO,CAAC,oBAAqB,SAAU,OAAO,EAC9C,MAAO,CAACQ,EAAO,CAAE,KAAAC,EAAM,OAAAC,CAAO,IAAM,CAClC,IAAMC,EAAOP,EAAiB,EAC1BQ,EACAC,EAAW,GACf,OAAAV,EAAU,IAAM,CACdS,EAASN,EAAaK,EAAK,MAAQ,CACjC,MAAOH,EAAM,WAAY,SAAUA,EAAM,SAAU,YAAaA,EAAM,YAAa,MAAOA,EAAM,MAAO,QAASA,EAAM,QACtH,OAAQA,EAAM,OAAQ,aAAcA,EAAM,aAC1C,SAAWM,GAAW,CACfD,IACHJ,EAAK,oBAAqBK,EAAO,IAAI,EACrCL,EAAK,SAAUK,CAAM,EAEzB,CACF,CAAC,EACDL,EAAK,QAASG,CAAM,CACtB,CAAC,EACDP,EAAM,IAAMG,EAAM,WAAaO,GAAU,CACvC,GAAI,GAACH,GAAUG,IAAUH,EAAO,QAAQ,GAExC,CAAAC,EAAW,GACX,GAAI,CACFD,EAAO,QAAQG,CAAK,CACtB,QACA,CACEF,EAAW,EACb,EACF,CAAC,EACDR,EAAM,IAAMG,EAAM,SAAWO,GAAUH,GAAQ,YAAYG,CAAK,CAAC,EACjEV,EAAM,IAAM,CAACG,EAAM,OAAQA,EAAM,YAAY,EAAY,CAAC,CAACQ,EAAQC,CAAY,IAAML,GAAQ,UAAUI,EAAQC,CAAY,EAAG,CAAE,KAAM,EAAK,CAAC,EAC5If,EAAgB,IAAMU,GAAQ,QAAQ,CAAC,EACvCF,EAAO,CAAE,UAAW,IAAME,CAAO,CAAC,EAC3B,IAAMX,EAAE,MAAO,CAAE,IAAKU,EAAM,MAAO,SAAU,CAAC,CACvD,CACF,CAAC",
|
|
6
|
+
"names": ["defineComponent", "h", "onBeforeUnmount", "onMounted", "ref", "watch", "createEditor", "MorfiraEditor", "props", "emit", "expose", "host", "editor", "applying", "change", "value", "locale", "translations"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morfira-dev/wysiwyg-vue",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@morfira-dev/wysiwyg-core": "^1.
|
|
22
|
+
"@morfira-dev/wysiwyg-core": "^1.6.1",
|
|
23
23
|
"vue": "^3.5.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependenciesMeta": {
|