@progress/kendo-vue-editor 5.3.0-dev.202409130647 → 5.3.0-develop.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/Editor.js +8 -0
- package/Editor.mjs +584 -0
- package/README.md +25 -31
- package/config/defaultStyles.js +204 -0
- package/config/defaultStyles.mjs +209 -0
- package/config/schema.js +8 -0
- package/config/schema.mjs +44 -0
- package/config/shortcuts.js +8 -0
- package/config/shortcuts.mjs +41 -0
- package/config/toolsSettings.js +8 -0
- package/config/toolsSettings.mjs +558 -0
- package/dialogs/FindReplace.js +8 -0
- package/dialogs/FindReplace.mjs +366 -0
- package/dialogs/insertImage.js +8 -0
- package/dialogs/insertImage.mjs +211 -0
- package/dialogs/insertLink.js +8 -0
- package/dialogs/insertLink.mjs +164 -0
- package/dialogs/viewHtml.js +8 -0
- package/dialogs/viewHtml.mjs +128 -0
- package/dist/cdn/js/kendo-vue-editor.js +8 -1
- package/index.d.mts +2936 -0
- package/index.d.ts +2936 -0
- package/index.js +8 -0
- package/index.mjs +207 -0
- package/messages/main.js +8 -0
- package/messages/main.mjs +182 -0
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +18 -0
- package/package.json +23 -62
- package/tools/align.js +8 -0
- package/tools/align.mjs +69 -0
- package/tools/applyColor.js +8 -0
- package/tools/applyColor.mjs +71 -0
- package/tools/cleanFormatting.js +8 -0
- package/tools/cleanFormatting.mjs +65 -0
- package/tools/findReplace.js +8 -0
- package/tools/findReplace.mjs +67 -0
- package/tools/fontStyle.js +8 -0
- package/tools/fontStyle.mjs +104 -0
- package/tools/formatBlock.js +8 -0
- package/tools/formatBlock.mjs +96 -0
- package/tools/indent.js +8 -0
- package/tools/indent.mjs +63 -0
- package/tools/inlineFormat.js +8 -0
- package/tools/inlineFormat.mjs +80 -0
- package/tools/insertImage.js +8 -0
- package/tools/insertImage.mjs +77 -0
- package/tools/insertLink.js +8 -0
- package/tools/insertLink.mjs +76 -0
- package/tools/insertTable/popup.js +8 -0
- package/tools/insertTable/popup.mjs +105 -0
- package/tools/insertTable/popupGrid.js +8 -0
- package/tools/insertTable/popupGrid.mjs +83 -0
- package/tools/insertTable/tool.js +8 -0
- package/tools/insertTable/tool.mjs +98 -0
- package/tools/lists.js +8 -0
- package/tools/lists.mjs +77 -0
- package/tools/outdent.js +8 -0
- package/tools/outdent.mjs +75 -0
- package/tools/pdf.js +8 -0
- package/tools/pdf.mjs +63 -0
- package/tools/print.js +8 -0
- package/tools/print.mjs +58 -0
- package/tools/proseMirrorTool.js +8 -0
- package/tools/proseMirrorTool.mjs +61 -0
- package/tools/selectAll.js +8 -0
- package/tools/selectAll.mjs +56 -0
- package/tools/unlink.js +8 -0
- package/tools/unlink.mjs +64 -0
- package/tools/utils.js +8 -0
- package/tools/utils.mjs +18 -0
- package/tools/viewHtml.js +8 -0
- package/tools/viewHtml.mjs +72 -0
- package/utils/browser-detection.js +8 -0
- package/utils/browser-detection.mjs +11 -0
- package/utils/controlled-value.js +8 -0
- package/utils/controlled-value.mjs +18 -0
- package/utils/main.js +8 -0
- package/utils/main.mjs +162 -0
- package/utils/props-key.js +8 -0
- package/utils/props-key.mjs +12 -0
- package/dist/es/Editor.d.ts +0 -283
- package/dist/es/Editor.js +0 -812
- package/dist/es/EditorProps.d.ts +0 -194
- package/dist/es/EditorProps.js +0 -1
- package/dist/es/additionalTypes.ts +0 -21
- package/dist/es/config/defaultStyles.d.ts +0 -12
- package/dist/es/config/defaultStyles.js +0 -12
- package/dist/es/config/pasteSettings.d.ts +0 -6
- package/dist/es/config/pasteSettings.js +0 -1
- package/dist/es/config/schema.d.ts +0 -8
- package/dist/es/config/schema.js +0 -51
- package/dist/es/config/shortcuts.d.ts +0 -24
- package/dist/es/config/shortcuts.js +0 -61
- package/dist/es/config/toolsSettings.d.ts +0 -489
- package/dist/es/config/toolsSettings.js +0 -528
- package/dist/es/dialogs/EditorDialogProps.d.ts +0 -23
- package/dist/es/dialogs/EditorDialogProps.js +0 -1
- package/dist/es/dialogs/FindReplace.d.ts +0 -70
- package/dist/es/dialogs/FindReplace.js +0 -909
- package/dist/es/dialogs/insertImage.d.ts +0 -54
- package/dist/es/dialogs/insertImage.js +0 -1164
- package/dist/es/dialogs/insertLink.d.ts +0 -52
- package/dist/es/dialogs/insertLink.js +0 -826
- package/dist/es/dialogs/main.d.ts +0 -1
- package/dist/es/dialogs/main.js +0 -42
- package/dist/es/dialogs/viewHtml.d.ts +0 -51
- package/dist/es/dialogs/viewHtml.js +0 -201
- package/dist/es/main.d.ts +0 -192
- package/dist/es/main.js +0 -217
- package/dist/es/messages/main.d.ts +0 -172
- package/dist/es/messages/main.js +0 -503
- package/dist/es/package-metadata.d.ts +0 -5
- package/dist/es/package-metadata.js +0 -11
- package/dist/es/tools/ToolProps.d.ts +0 -35
- package/dist/es/tools/ToolProps.js +0 -1
- package/dist/es/tools/align.d.ts +0 -42
- package/dist/es/tools/align.js +0 -111
- package/dist/es/tools/applyColor.d.ts +0 -45
- package/dist/es/tools/applyColor.js +0 -100
- package/dist/es/tools/cleanFormatting.d.ts +0 -49
- package/dist/es/tools/cleanFormatting.js +0 -107
- package/dist/es/tools/findReplace.d.ts +0 -43
- package/dist/es/tools/findReplace.js +0 -115
- package/dist/es/tools/fontStyle.d.ts +0 -55
- package/dist/es/tools/fontStyle.js +0 -150
- package/dist/es/tools/formatBlock.d.ts +0 -45
- package/dist/es/tools/formatBlock.js +0 -145
- package/dist/es/tools/history.d.ts +0 -18
- package/dist/es/tools/history.js +0 -3
- package/dist/es/tools/indent.d.ts +0 -44
- package/dist/es/tools/indent.js +0 -121
- package/dist/es/tools/inlineFormat.d.ts +0 -74
- package/dist/es/tools/inlineFormat.js +0 -120
- package/dist/es/tools/insertImage.d.ts +0 -46
- package/dist/es/tools/insertImage.js +0 -126
- package/dist/es/tools/insertLink.d.ts +0 -46
- package/dist/es/tools/insertLink.js +0 -126
- package/dist/es/tools/insertTable/popup.d.ts +0 -80
- package/dist/es/tools/insertTable/popup.js +0 -177
- package/dist/es/tools/insertTable/popupGrid.d.ts +0 -51
- package/dist/es/tools/insertTable/popupGrid.js +0 -131
- package/dist/es/tools/insertTable/tool.d.ts +0 -53
- package/dist/es/tools/insertTable/tool.js +0 -157
- package/dist/es/tools/lists.d.ts +0 -48
- package/dist/es/tools/lists.js +0 -124
- package/dist/es/tools/main.d.ts +0 -95
- package/dist/es/tools/main.js +0 -1
- package/dist/es/tools/outdent.d.ts +0 -44
- package/dist/es/tools/outdent.js +0 -123
- package/dist/es/tools/pdf.d.ts +0 -58
- package/dist/es/tools/pdf.js +0 -100
- package/dist/es/tools/print.d.ts +0 -49
- package/dist/es/tools/print.js +0 -103
- package/dist/es/tools/proseMirrorTool.d.ts +0 -48
- package/dist/es/tools/proseMirrorTool.js +0 -104
- package/dist/es/tools/selectAll.d.ts +0 -49
- package/dist/es/tools/selectAll.js +0 -97
- package/dist/es/tools/tableEdit.d.ts +0 -51
- package/dist/es/tools/tableEdit.js +0 -34
- package/dist/es/tools/unlink.d.ts +0 -47
- package/dist/es/tools/unlink.js +0 -104
- package/dist/es/tools/utils.d.ts +0 -18
- package/dist/es/tools/utils.js +0 -31
- package/dist/es/tools/viewHtml.d.ts +0 -54
- package/dist/es/tools/viewHtml.js +0 -121
- package/dist/es/utils/browser-detection.d.ts +0 -4
- package/dist/es/utils/browser-detection.js +0 -5
- package/dist/es/utils/controlled-value.d.ts +0 -5
- package/dist/es/utils/controlled-value.js +0 -31
- package/dist/es/utils/main.d.ts +0 -357
- package/dist/es/utils/main.js +0 -422
- package/dist/es/utils/props-key.d.ts +0 -5
- package/dist/es/utils/props-key.js +0 -5
- package/dist/esm/Editor.d.ts +0 -283
- package/dist/esm/Editor.js +0 -812
- package/dist/esm/EditorProps.d.ts +0 -194
- package/dist/esm/EditorProps.js +0 -1
- package/dist/esm/additionalTypes.ts +0 -21
- package/dist/esm/config/defaultStyles.d.ts +0 -12
- package/dist/esm/config/defaultStyles.js +0 -12
- package/dist/esm/config/pasteSettings.d.ts +0 -6
- package/dist/esm/config/pasteSettings.js +0 -1
- package/dist/esm/config/schema.d.ts +0 -8
- package/dist/esm/config/schema.js +0 -51
- package/dist/esm/config/shortcuts.d.ts +0 -24
- package/dist/esm/config/shortcuts.js +0 -61
- package/dist/esm/config/toolsSettings.d.ts +0 -489
- package/dist/esm/config/toolsSettings.js +0 -528
- package/dist/esm/dialogs/EditorDialogProps.d.ts +0 -23
- package/dist/esm/dialogs/EditorDialogProps.js +0 -1
- package/dist/esm/dialogs/FindReplace.d.ts +0 -70
- package/dist/esm/dialogs/FindReplace.js +0 -909
- package/dist/esm/dialogs/insertImage.d.ts +0 -54
- package/dist/esm/dialogs/insertImage.js +0 -1164
- package/dist/esm/dialogs/insertLink.d.ts +0 -52
- package/dist/esm/dialogs/insertLink.js +0 -826
- package/dist/esm/dialogs/main.d.ts +0 -1
- package/dist/esm/dialogs/main.js +0 -42
- package/dist/esm/dialogs/viewHtml.d.ts +0 -51
- package/dist/esm/dialogs/viewHtml.js +0 -201
- package/dist/esm/main.d.ts +0 -192
- package/dist/esm/main.js +0 -217
- package/dist/esm/messages/main.d.ts +0 -172
- package/dist/esm/messages/main.js +0 -503
- package/dist/esm/package-metadata.d.ts +0 -5
- package/dist/esm/package-metadata.js +0 -11
- package/dist/esm/package.json +0 -3
- package/dist/esm/tools/ToolProps.d.ts +0 -35
- package/dist/esm/tools/ToolProps.js +0 -1
- package/dist/esm/tools/align.d.ts +0 -42
- package/dist/esm/tools/align.js +0 -111
- package/dist/esm/tools/applyColor.d.ts +0 -45
- package/dist/esm/tools/applyColor.js +0 -100
- package/dist/esm/tools/cleanFormatting.d.ts +0 -49
- package/dist/esm/tools/cleanFormatting.js +0 -107
- package/dist/esm/tools/findReplace.d.ts +0 -43
- package/dist/esm/tools/findReplace.js +0 -115
- package/dist/esm/tools/fontStyle.d.ts +0 -55
- package/dist/esm/tools/fontStyle.js +0 -150
- package/dist/esm/tools/formatBlock.d.ts +0 -45
- package/dist/esm/tools/formatBlock.js +0 -145
- package/dist/esm/tools/history.d.ts +0 -18
- package/dist/esm/tools/history.js +0 -3
- package/dist/esm/tools/indent.d.ts +0 -44
- package/dist/esm/tools/indent.js +0 -121
- package/dist/esm/tools/inlineFormat.d.ts +0 -74
- package/dist/esm/tools/inlineFormat.js +0 -120
- package/dist/esm/tools/insertImage.d.ts +0 -46
- package/dist/esm/tools/insertImage.js +0 -126
- package/dist/esm/tools/insertLink.d.ts +0 -46
- package/dist/esm/tools/insertLink.js +0 -126
- package/dist/esm/tools/insertTable/popup.d.ts +0 -80
- package/dist/esm/tools/insertTable/popup.js +0 -177
- package/dist/esm/tools/insertTable/popupGrid.d.ts +0 -51
- package/dist/esm/tools/insertTable/popupGrid.js +0 -131
- package/dist/esm/tools/insertTable/tool.d.ts +0 -53
- package/dist/esm/tools/insertTable/tool.js +0 -157
- package/dist/esm/tools/lists.d.ts +0 -48
- package/dist/esm/tools/lists.js +0 -124
- package/dist/esm/tools/main.d.ts +0 -95
- package/dist/esm/tools/main.js +0 -1
- package/dist/esm/tools/outdent.d.ts +0 -44
- package/dist/esm/tools/outdent.js +0 -123
- package/dist/esm/tools/pdf.d.ts +0 -58
- package/dist/esm/tools/pdf.js +0 -100
- package/dist/esm/tools/print.d.ts +0 -49
- package/dist/esm/tools/print.js +0 -103
- package/dist/esm/tools/proseMirrorTool.d.ts +0 -48
- package/dist/esm/tools/proseMirrorTool.js +0 -104
- package/dist/esm/tools/selectAll.d.ts +0 -49
- package/dist/esm/tools/selectAll.js +0 -97
- package/dist/esm/tools/tableEdit.d.ts +0 -51
- package/dist/esm/tools/tableEdit.js +0 -34
- package/dist/esm/tools/unlink.d.ts +0 -47
- package/dist/esm/tools/unlink.js +0 -104
- package/dist/esm/tools/utils.d.ts +0 -18
- package/dist/esm/tools/utils.js +0 -31
- package/dist/esm/tools/viewHtml.d.ts +0 -54
- package/dist/esm/tools/viewHtml.js +0 -121
- package/dist/esm/utils/browser-detection.d.ts +0 -4
- package/dist/esm/utils/browser-detection.js +0 -5
- package/dist/esm/utils/controlled-value.d.ts +0 -5
- package/dist/esm/utils/controlled-value.js +0 -31
- package/dist/esm/utils/main.d.ts +0 -357
- package/dist/esm/utils/main.js +0 -422
- package/dist/esm/utils/props-key.d.ts +0 -5
- package/dist/esm/utils/props-key.js +0 -5
- package/dist/npm/Editor.d.ts +0 -283
- package/dist/npm/Editor.js +0 -819
- package/dist/npm/EditorProps.d.ts +0 -194
- package/dist/npm/EditorProps.js +0 -2
- package/dist/npm/additionalTypes.ts +0 -21
- package/dist/npm/config/defaultStyles.d.ts +0 -12
- package/dist/npm/config/defaultStyles.js +0 -15
- package/dist/npm/config/pasteSettings.d.ts +0 -6
- package/dist/npm/config/pasteSettings.js +0 -2
- package/dist/npm/config/schema.d.ts +0 -8
- package/dist/npm/config/schema.js +0 -55
- package/dist/npm/config/shortcuts.d.ts +0 -24
- package/dist/npm/config/shortcuts.js +0 -68
- package/dist/npm/config/toolsSettings.d.ts +0 -489
- package/dist/npm/config/toolsSettings.js +0 -531
- package/dist/npm/dialogs/EditorDialogProps.d.ts +0 -23
- package/dist/npm/dialogs/EditorDialogProps.js +0 -2
- package/dist/npm/dialogs/FindReplace.d.ts +0 -70
- package/dist/npm/dialogs/FindReplace.js +0 -916
- package/dist/npm/dialogs/insertImage.d.ts +0 -54
- package/dist/npm/dialogs/insertImage.js +0 -1171
- package/dist/npm/dialogs/insertLink.d.ts +0 -52
- package/dist/npm/dialogs/insertLink.js +0 -833
- package/dist/npm/dialogs/main.d.ts +0 -1
- package/dist/npm/dialogs/main.js +0 -42
- package/dist/npm/dialogs/viewHtml.d.ts +0 -51
- package/dist/npm/dialogs/viewHtml.js +0 -208
- package/dist/npm/main.d.ts +0 -192
- package/dist/npm/main.js +0 -217
- package/dist/npm/messages/main.d.ts +0 -172
- package/dist/npm/messages/main.js +0 -506
- package/dist/npm/package-metadata.d.ts +0 -5
- package/dist/npm/package-metadata.js +0 -14
- package/dist/npm/tools/ToolProps.d.ts +0 -35
- package/dist/npm/tools/ToolProps.js +0 -2
- package/dist/npm/tools/align.d.ts +0 -42
- package/dist/npm/tools/align.js +0 -118
- package/dist/npm/tools/applyColor.d.ts +0 -45
- package/dist/npm/tools/applyColor.js +0 -107
- package/dist/npm/tools/cleanFormatting.d.ts +0 -49
- package/dist/npm/tools/cleanFormatting.js +0 -114
- package/dist/npm/tools/findReplace.d.ts +0 -43
- package/dist/npm/tools/findReplace.js +0 -122
- package/dist/npm/tools/fontStyle.d.ts +0 -55
- package/dist/npm/tools/fontStyle.js +0 -157
- package/dist/npm/tools/formatBlock.d.ts +0 -45
- package/dist/npm/tools/formatBlock.js +0 -152
- package/dist/npm/tools/history.d.ts +0 -18
- package/dist/npm/tools/history.js +0 -8
- package/dist/npm/tools/indent.d.ts +0 -44
- package/dist/npm/tools/indent.js +0 -128
- package/dist/npm/tools/inlineFormat.d.ts +0 -74
- package/dist/npm/tools/inlineFormat.js +0 -127
- package/dist/npm/tools/insertImage.d.ts +0 -46
- package/dist/npm/tools/insertImage.js +0 -133
- package/dist/npm/tools/insertLink.d.ts +0 -46
- package/dist/npm/tools/insertLink.js +0 -133
- package/dist/npm/tools/insertTable/popup.d.ts +0 -80
- package/dist/npm/tools/insertTable/popup.js +0 -184
- package/dist/npm/tools/insertTable/popupGrid.d.ts +0 -51
- package/dist/npm/tools/insertTable/popupGrid.js +0 -138
- package/dist/npm/tools/insertTable/tool.d.ts +0 -53
- package/dist/npm/tools/insertTable/tool.js +0 -164
- package/dist/npm/tools/lists.d.ts +0 -48
- package/dist/npm/tools/lists.js +0 -131
- package/dist/npm/tools/main.d.ts +0 -95
- package/dist/npm/tools/main.js +0 -5
- package/dist/npm/tools/outdent.d.ts +0 -44
- package/dist/npm/tools/outdent.js +0 -130
- package/dist/npm/tools/pdf.d.ts +0 -58
- package/dist/npm/tools/pdf.js +0 -107
- package/dist/npm/tools/print.d.ts +0 -49
- package/dist/npm/tools/print.js +0 -110
- package/dist/npm/tools/proseMirrorTool.d.ts +0 -48
- package/dist/npm/tools/proseMirrorTool.js +0 -111
- package/dist/npm/tools/selectAll.d.ts +0 -49
- package/dist/npm/tools/selectAll.js +0 -104
- package/dist/npm/tools/tableEdit.d.ts +0 -51
- package/dist/npm/tools/tableEdit.js +0 -39
- package/dist/npm/tools/unlink.d.ts +0 -47
- package/dist/npm/tools/unlink.js +0 -111
- package/dist/npm/tools/utils.d.ts +0 -18
- package/dist/npm/tools/utils.js +0 -39
- package/dist/npm/tools/viewHtml.d.ts +0 -54
- package/dist/npm/tools/viewHtml.js +0 -128
- package/dist/npm/utils/browser-detection.d.ts +0 -4
- package/dist/npm/utils/browser-detection.js +0 -8
- package/dist/npm/utils/controlled-value.d.ts +0 -5
- package/dist/npm/utils/controlled-value.js +0 -35
- package/dist/npm/utils/main.d.ts +0 -357
- package/dist/npm/utils/main.js +0 -425
- package/dist/npm/utils/props-key.d.ts +0 -5
- package/dist/npm/utils/props-key.js +0 -8
package/Editor.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),A=require("@progress/kendo-vue-buttons"),a=require("@progress/kendo-vue-common"),s=require("@progress/kendo-editor-common"),U=require("./config/schema.js"),P=require("./config/defaultStyles.js"),e=require("./config/toolsSettings.js"),_=require("./dialogs/insertLink.js"),b=require("./utils/main.js"),$=require("./utils/props-key.js"),x=require("./utils/controlled-value.js"),F=require("./utils/browser-detection.js"),M=require("./package-metadata.js"),C=require("./tools/align.js"),z=require("./tools/indent.js"),B=require("./tools/lists.js"),W=require("./tools/outdent.js"),E=require("./tools/inlineFormat.js"),R=require("./tools/fontStyle.js"),j=require("./tools/formatBlock.js"),p=require("./tools/proseMirrorTool.js"),I=require("./tools/insertLink.js"),G=require("./tools/unlink.js"),K=require("./tools/cleanFormatting.js"),J=require("./tools/selectAll.js"),Q=require("./tools/insertImage.js"),X=require("./tools/insertTable/tool.js"),Y=require("./tools/viewHtml.js"),Z=require("./tools/pdf.js"),ee=require("./tools/print.js"),te=require("./tools/findReplace.js"),N=require("./tools/applyColor.js"),h=require("./messages/main.js"),oe=require("@progress/kendo-vue-intl"),{link:O,bold:ie,italic:se,underline:re}=e.EditorToolsSettings;function H(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!r.isVNode(t)}const w={Bold:{comp:E.InlineFormat,props:e.EditorToolsSettings.bold},Italic:{comp:E.InlineFormat,props:e.EditorToolsSettings.italic},Underline:{comp:E.InlineFormat,props:e.EditorToolsSettings.underline},Strikethrough:{comp:E.InlineFormat,props:e.EditorToolsSettings.strikethrough},Subscript:{comp:E.InlineFormat,props:e.EditorToolsSettings.subscript},Superscript:{comp:E.InlineFormat,props:e.EditorToolsSettings.superscript},AlignLeft:{comp:C.Align,props:e.EditorToolsSettings.alignLeft},AlignCenter:{comp:C.Align,props:e.EditorToolsSettings.alignCenter},AlignRight:{comp:C.Align,props:e.EditorToolsSettings.alignRight},AlignJustify:{comp:C.Align,props:e.EditorToolsSettings.alignJustify},Indent:{comp:z.Indent,props:e.EditorToolsSettings.indent},Outdent:{comp:W.Outdent,props:e.EditorToolsSettings.outdent},OrderedList:{comp:B.List,props:e.EditorToolsSettings.orderedList},UnorderedList:{comp:B.List,props:e.EditorToolsSettings.bulletList},FontSize:{comp:R.FontName,props:e.EditorToolsSettings.fontSize},FontName:{comp:R.FontName,props:e.EditorToolsSettings.fontName},FormatBlock:{comp:j.FormatBlock,props:e.EditorToolsSettings.formatBlock},Undo:{comp:p.ProseMirror,props:e.EditorToolsSettings.undo},Redo:{comp:p.ProseMirror,props:e.EditorToolsSettings.redo},Link:{comp:I.LinkTool,props:e.EditorToolsSettings.link},Unlink:{comp:G.Unlink,props:e.EditorToolsSettings.unlink},InsertImage:{comp:Q.InsertImage,props:e.EditorToolsSettings.image},ViewHtml:{comp:Y.ViewHtml,props:e.EditorToolsSettings.viewHtml},CleanFormatting:{comp:K.CleanFormatting,props:e.EditorToolsSettings.cleanFormatting},SelectAll:{comp:J.SelectAll,props:e.EditorToolsSettings.selectAll},InsertTable:{comp:X.InsertTable,props:e.EditorToolsSettings.insertTable},MergeCells:{comp:p.ProseMirror,props:e.EditorToolsSettings.mergeCells},SplitCell:{comp:p.ProseMirror,props:e.EditorToolsSettings.splitCell},AddRowBefore:{comp:p.ProseMirror,props:e.EditorToolsSettings.addRowBefore},AddRowAfter:{comp:p.ProseMirror,props:e.EditorToolsSettings.addRowAfter},AddColumnBefore:{comp:p.ProseMirror,props:e.EditorToolsSettings.addColumnBefore},AddColumnAfter:{comp:p.ProseMirror,props:e.EditorToolsSettings.addColumnAfter},DeleteRow:{comp:p.ProseMirror,props:e.EditorToolsSettings.deleteRow},DeleteColumn:{comp:p.ProseMirror,props:e.EditorToolsSettings.deleteColumn},DeleteTable:{comp:p.ProseMirror,props:e.EditorToolsSettings.deleteTable},Print:{comp:ee.Print,props:e.EditorToolsSettings.print},Pdf:{comp:Z.Pdf,props:e.EditorToolsSettings.pdf},InsertFile:{comp:I.LinkTool,props:e.EditorToolsSettings.insertFile},FindAndReplace:{comp:te.FindAndReplace,props:e.EditorToolsSettings.findAndReplace},ForeColor:{comp:N.ApplyColor,props:e.EditorToolsSettings.foreColor},BackColor:{comp:N.ApplyColor,props:e.EditorToolsSettings.backColor}},ne=r.defineComponent({name:"KendoEditor",emits:{focus:null,blur:null,change:null,loaded:null,execute:null},inject:{kendoLocalizationService:{default:null}},props:{defaultContent:String,value:[Object,String],defaultEditMode:{type:String,default:"iframe",validator:function(t){return["iframe","div"].includes(t)}},contentStyle:Object,dir:String,tools:Array,keyboardNavigation:{type:Boolean,default:!0},resizable:Boolean,preserveWhitespace:{type:[String,Boolean],default:"full",validator:function(t){return[!0,!1,"full"].includes(t)}},pasteHtml:Function,extendView:Function,ariaDescribedBy:String,ariaLabelledBy:String,ariaLabel:String},data(){return{updateGuid:a.guid(),view:void 0,linkDialog:!1,showLicenseWatermark:!1}},created(){this._view=void 0,this.trOnChange=null,this.valueisUpdated=!1,this._prevValue=this.$props.value,a.validatePackage(M.packageMetadata),this.showLicenseWatermark=a.shouldShowValidationUI(M.packageMetadata)},mounted(){this.iframe=a.getRef(this,"iframe"),this.contentElement=a.getRef(this,"contentElement"),(!this.iframe||!F.firefox)&&this.initialize()},watch:{value:function(t,o){this.valueisUpdated=!0,this._prevValue=o}},updated(){const{value:t}=this.$props,o=this.getView();t===void 0||!this.valueisUpdated||!o||(x.updateEditorValue(o,this.computedValue(),this._prevValue,this.trOnChange,this.htmlOnChange),this.valueisUpdated=!1,this.trOnChange=null,this.htmlOnChange=null)},unmounted(){this.getView()&&this.getView().destroy(),this.view=void 0,this._view=void 0},render(){let t=100;const{tools:o=[],defaultEditMode:n="iframe",preserveWhitespace:v="full",style:g,value:y}=this.$props,T=this.getView(),m=oe.provideLocalizationService(this),V=this.showLicenseWatermark?r.createVNode(a.WatermarkOverlay,null,null):null;if(this.view){const i=$.editorPropsKey.getState(this.view.state);i.preserveWhitespace=v}let S=this.$props.contentStyle;S===void 0&&(g||{}).height===void 0&&(S={height:"300px"});const q=function(){return this.linkDialog&&r.createVNode(_.InsertLinkDialog,{view:T,settings:O,dir:this.$props.dir,onClose:this.handleClose},null)},l=function(i,f){const c=w[i]||i,D=function(){let k;return i==="ForeColor"?k=m.toLanguageString(h.keys.foregroundColorAriaLabel,h.messages[h.keys.foregroundColorAriaLabel]):i==="BackColor"&&(k=m.toLanguageString(h.keys.backgroundColor,h.messages[h.keys.backgroundColor])),k};if(w[i]){t++;const k={view:T,dir:this.$props.dir,key:t,updateGuid:this.updateGuid,settings:w[i].props,...w[i].props,ariaLabel:D()};return r.h(r.markRaw(w[i].comp),k)}else{if(c==="Separator")return r.createVNode(A.ToolbarSeparator,{key:t},null);{const k=a.templateRendering.call(this,c.render,a.getListeners.call(this));return a.getTemplate.call(this,{h:r.h,template:k,defaultRendering:null,additionalListeners:{},additionalProps:{view:T,dir:this.$props.dir,updateGuid:this.updateGuid,key:t,settings:c.props}})}}},u=function(i,f){return i.map(function(c){return l.call(this,c,f)},this)},d=o.map(function(i,f){let c;return Array.isArray(i)?r.createVNode(A.ButtonGroup,{key:f},H(c=u.call(this,i,f))?c:{default:()=>[c]}):l.call(this,i,f)},this);return r.createVNode("div",{class:a.classNames("k-editor",{"k-editor-resizable":this.$props.resizable}),dir:this.$props.dir},[d.length>0&&r.createVNode(A.Toolbar,{class:"k-editor-toolbar",keyboardNavigation:this.$props.keyboardNavigation},H(d)?d:{default:()=>[d]}),n==="iframe"?r.createVNode("div",{class:"k-editor-content"},[r.createVNode("iframe",{onLoad:this.iframeLoad,ref:a.setRef(this,"iframe"),frameborder:"0",title:m.toLanguageString(h.keys.iframeTitle,h.messages[h.keys.iframeTitle]),style:S,class:"k-iframe"},null)]):r.createVNode("div",{style:S,class:"k-editor-content"},[r.createVNode("div",{ref:a.setRef(this,"contentElement"),role:"textbox","aria-labelledby":this.$props.ariaLabelledBy,"aria-describedby":this.$props.ariaDescribedBy,"aria-label":this.$props.ariaLabel},null)]),q.call(this),V])},methods:{getView(){return this.view},getHTML(){const t=this.getView();return t?b.EditorUtils.getHtml(t.state):""},setHTML(t){const o=this.getView();o&&b.EditorUtils.setHtml(o,t)},focus(){this.getView()&&this.getView().focus()},updateTools(t){this.view=t,this.updateGuid=a.guid()},iframeLoad(){F.firefox&&this.initialize()},initialize(){const t=this.iframe&&this.iframe.contentWindow;if(t){const l=t.document;[P.defaultStyle,P.tablesStyles,this.$props.dir==="rtl"?P.rtlStyles:void 0].forEach(d=>{if(d){const i=l.createElement("style");i.appendChild(l.createTextNode(d)),l.head.appendChild(i)}});const u=l.createElement("meta");u.setAttribute("charset","utf-8"),l.head.appendChild(u),this.contentElement=l.createElement("div"),l.body.appendChild(this.contentElement),this.contentElement.classList.add("k-content"),this.contentElement.setAttribute("role","main")}const o=this.contentElement;if(!o)return;const{preserveWhitespace:n="full"}=this.$props,v=this;let g=[new s.Plugin({view:()=>({update:this.updateTools}),key:new s.PluginKey("toolbar-tools-update-plugin")}),new s.Plugin({filterTransaction:this.filterTransaction,key:new s.PluginKey("onExecute-event-plugin")}),new s.Plugin({key:$.editorPropsKey,state:{init:()=>({preserveWhitespace:n}),apply:(l,u)=>u}}),s.spacesFix(),s.history(),s.dropCursor(),s.gapCursor(),s.tableEditing()],y={...b.EditorUtils.getShortcuts({types:{listItem:"list_item",hardBreak:"hard_break"},toolsSettings:{bold:ie,italic:se,underline:re}}),"Mod-k":()=>{const{linkDialog:l}=this.$data,u=this.getView();if(u){const d=u.state,i=d.selection.empty,f=s.getMark(d,d.schema.marks[O.mark]);!l&&!(i&&!f)&&(this.linkDialog=!0)}return!l}};const{defaultContent:T="",value:m}=this.$props,V=m&&typeof m!="string"?r.toRaw(m):b.EditorUtils.createDocument(new s.Schema({nodes:U.nodes,marks:s.marks}),m||T,{preserveWhitespace:n}),L={state:s.EditorState.create({plugins:[...g,s.keymap(y),s.keymap(s.baseKeymap)],doc:V}),transformPastedHTML:this.onPasteHtml,dispatchTransaction:this.dispatchTransaction,handleDOMEvents:{focus:this.onFocus,blur:this.onBlur,paste:this.onPaste}},S={plugins:g,shortcuts:y,target:v,viewProps:L,dom:o};this.$emit("loaded",S);const q=this.$props.extendView&&this.$props.extendView(S)||new s.EditorView({mount:o},L);this.view=r.markRaw(q)},filterTransaction(t,o){const n={target:this,transaction:t,state:o};return this.$emit("execute",n),!0},onPasteHtml(t){if(this.$props.pasteHtml&&this.pasteEvent){const o={target:this,pastedHtml:t,event:this.pasteEvent},n=this.$props.pasteHtml(o);if(this.pasteEvent=void 0,typeof n=="string")return n}return t},dispatchTransaction(t){const o=t.docChanged;if(o){this.trOnChange=t;const n=t.doc,v=t.doc.type.schema,g=this,y={target:g,value:n,get html(){return g.htmlOnChange=b.EditorUtils.getHtml({doc:n,schema:v}),g.htmlOnChange},transaction:t,schema:v};this.$emit("change",y)}this.getView()&&(this.$props.value===void 0||!o)&&this.getView().updateState(this.getView().state.apply(t))},onFocus(t,o){const n={target:this,event:o};return this.$emit("focus",n),!1},onBlur(t,o){const n={target:this,event:o};return this.$emit("blur",n),!1},onPaste(t,o){return this.$props.pasteHtml&&(this.pasteEvent=o),!1},handleClose(){this.linkDialog=!1},computedValue(){return this.trOnChange!==null?this.trOnChange.doc:this.$props.value!==void 0?this.$props.value:this.getView()?this.getView().state.doc:this.$props.defaultContent||""}}});exports.Editor=ne;exports.allTools=w;
|
package/Editor.mjs
ADDED
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { defineComponent as j, createVNode as p, toRaw as K, markRaw as B, isVNode as J, h as F } from "vue";
|
|
9
|
+
import { ButtonGroup as q, Toolbar as Q, ToolbarSeparator as X } from "@progress/kendo-vue-buttons";
|
|
10
|
+
import { guid as T, validatePackage as Y, shouldShowValidationUI as Z, getRef as O, WatermarkOverlay as ee, classNames as te, setRef as P, templateRendering as ie, getListeners as oe, getTemplate as re } from "@progress/kendo-vue-common";
|
|
11
|
+
import { Plugin as E, PluginKey as R, spacesFix as se, history as ne, dropCursor as ae, gapCursor as le, tableEditing as pe, getMark as de, Schema as ce, marks as me, EditorState as ue, keymap as H, baseKeymap as he, EditorView as fe } from "@progress/kendo-editor-common";
|
|
12
|
+
import { nodes as ge } from "./config/schema.mjs";
|
|
13
|
+
import { defaultStyle as ve, tablesStyles as we, rtlStyles as ke } from "./config/defaultStyles.mjs";
|
|
14
|
+
import { EditorToolsSettings as e } from "./config/toolsSettings.mjs";
|
|
15
|
+
import { InsertLinkDialog as be } from "./dialogs/insertLink.mjs";
|
|
16
|
+
import { EditorUtils as y } from "./utils/main.mjs";
|
|
17
|
+
import { editorPropsKey as D } from "./utils/props-key.mjs";
|
|
18
|
+
import { updateEditorValue as ye } from "./utils/controlled-value.mjs";
|
|
19
|
+
import { firefox as _ } from "./utils/browser-detection.mjs";
|
|
20
|
+
import { packageMetadata as x } from "./package-metadata.mjs";
|
|
21
|
+
import { Align as S } from "./tools/align.mjs";
|
|
22
|
+
import { Indent as Ce } from "./tools/indent.mjs";
|
|
23
|
+
import { List as I } from "./tools/lists.mjs";
|
|
24
|
+
import { Outdent as Se } from "./tools/outdent.mjs";
|
|
25
|
+
import { InlineFormat as v } from "./tools/inlineFormat.mjs";
|
|
26
|
+
import { FontName as M } from "./tools/fontStyle.mjs";
|
|
27
|
+
import { FormatBlock as Le } from "./tools/formatBlock.mjs";
|
|
28
|
+
import { ProseMirror as a } from "./tools/proseMirrorTool.mjs";
|
|
29
|
+
import { LinkTool as N } from "./tools/insertLink.mjs";
|
|
30
|
+
import { Unlink as Ve } from "./tools/unlink.mjs";
|
|
31
|
+
import { CleanFormatting as $e } from "./tools/cleanFormatting.mjs";
|
|
32
|
+
import { SelectAll as Ee } from "./tools/selectAll.mjs";
|
|
33
|
+
import { InsertImage as Ae } from "./tools/insertImage.mjs";
|
|
34
|
+
import { InsertTable as Be } from "./tools/insertTable/tool.mjs";
|
|
35
|
+
import { ViewHtml as Fe } from "./tools/viewHtml.mjs";
|
|
36
|
+
import { Pdf as Te } from "./tools/pdf.mjs";
|
|
37
|
+
import { Print as Oe } from "./tools/print.mjs";
|
|
38
|
+
import { FindAndReplace as Pe } from "./tools/findReplace.mjs";
|
|
39
|
+
import { ApplyColor as U } from "./tools/applyColor.mjs";
|
|
40
|
+
import { keys as w, messages as A } from "./messages/main.mjs";
|
|
41
|
+
import { provideLocalizationService as Re } from "@progress/kendo-vue-intl";
|
|
42
|
+
const {
|
|
43
|
+
link: z,
|
|
44
|
+
bold: He,
|
|
45
|
+
italic: De,
|
|
46
|
+
underline: _e
|
|
47
|
+
} = e;
|
|
48
|
+
function W(t) {
|
|
49
|
+
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !J(t);
|
|
50
|
+
}
|
|
51
|
+
const C = {
|
|
52
|
+
Bold: {
|
|
53
|
+
comp: v,
|
|
54
|
+
props: e.bold
|
|
55
|
+
},
|
|
56
|
+
Italic: {
|
|
57
|
+
comp: v,
|
|
58
|
+
props: e.italic
|
|
59
|
+
},
|
|
60
|
+
Underline: {
|
|
61
|
+
comp: v,
|
|
62
|
+
props: e.underline
|
|
63
|
+
},
|
|
64
|
+
Strikethrough: {
|
|
65
|
+
comp: v,
|
|
66
|
+
props: e.strikethrough
|
|
67
|
+
},
|
|
68
|
+
Subscript: {
|
|
69
|
+
comp: v,
|
|
70
|
+
props: e.subscript
|
|
71
|
+
},
|
|
72
|
+
Superscript: {
|
|
73
|
+
comp: v,
|
|
74
|
+
props: e.superscript
|
|
75
|
+
},
|
|
76
|
+
AlignLeft: {
|
|
77
|
+
comp: S,
|
|
78
|
+
props: e.alignLeft
|
|
79
|
+
},
|
|
80
|
+
AlignCenter: {
|
|
81
|
+
comp: S,
|
|
82
|
+
props: e.alignCenter
|
|
83
|
+
},
|
|
84
|
+
AlignRight: {
|
|
85
|
+
comp: S,
|
|
86
|
+
props: e.alignRight
|
|
87
|
+
},
|
|
88
|
+
AlignJustify: {
|
|
89
|
+
comp: S,
|
|
90
|
+
props: e.alignJustify
|
|
91
|
+
},
|
|
92
|
+
Indent: {
|
|
93
|
+
comp: Ce,
|
|
94
|
+
props: e.indent
|
|
95
|
+
},
|
|
96
|
+
Outdent: {
|
|
97
|
+
comp: Se,
|
|
98
|
+
props: e.outdent
|
|
99
|
+
},
|
|
100
|
+
OrderedList: {
|
|
101
|
+
comp: I,
|
|
102
|
+
props: e.orderedList
|
|
103
|
+
},
|
|
104
|
+
UnorderedList: {
|
|
105
|
+
comp: I,
|
|
106
|
+
props: e.bulletList
|
|
107
|
+
},
|
|
108
|
+
FontSize: {
|
|
109
|
+
comp: M,
|
|
110
|
+
props: e.fontSize
|
|
111
|
+
},
|
|
112
|
+
FontName: {
|
|
113
|
+
comp: M,
|
|
114
|
+
props: e.fontName
|
|
115
|
+
},
|
|
116
|
+
FormatBlock: {
|
|
117
|
+
comp: Le,
|
|
118
|
+
props: e.formatBlock
|
|
119
|
+
},
|
|
120
|
+
Undo: {
|
|
121
|
+
comp: a,
|
|
122
|
+
props: e.undo
|
|
123
|
+
},
|
|
124
|
+
Redo: {
|
|
125
|
+
comp: a,
|
|
126
|
+
props: e.redo
|
|
127
|
+
},
|
|
128
|
+
Link: {
|
|
129
|
+
comp: N,
|
|
130
|
+
props: e.link
|
|
131
|
+
},
|
|
132
|
+
Unlink: {
|
|
133
|
+
comp: Ve,
|
|
134
|
+
props: e.unlink
|
|
135
|
+
},
|
|
136
|
+
InsertImage: {
|
|
137
|
+
comp: Ae,
|
|
138
|
+
props: e.image
|
|
139
|
+
},
|
|
140
|
+
ViewHtml: {
|
|
141
|
+
comp: Fe,
|
|
142
|
+
props: e.viewHtml
|
|
143
|
+
},
|
|
144
|
+
CleanFormatting: {
|
|
145
|
+
comp: $e,
|
|
146
|
+
props: e.cleanFormatting
|
|
147
|
+
},
|
|
148
|
+
SelectAll: {
|
|
149
|
+
comp: Ee,
|
|
150
|
+
props: e.selectAll
|
|
151
|
+
},
|
|
152
|
+
InsertTable: {
|
|
153
|
+
comp: Be,
|
|
154
|
+
props: e.insertTable
|
|
155
|
+
},
|
|
156
|
+
MergeCells: {
|
|
157
|
+
comp: a,
|
|
158
|
+
props: e.mergeCells
|
|
159
|
+
},
|
|
160
|
+
SplitCell: {
|
|
161
|
+
comp: a,
|
|
162
|
+
props: e.splitCell
|
|
163
|
+
},
|
|
164
|
+
AddRowBefore: {
|
|
165
|
+
comp: a,
|
|
166
|
+
props: e.addRowBefore
|
|
167
|
+
},
|
|
168
|
+
AddRowAfter: {
|
|
169
|
+
comp: a,
|
|
170
|
+
props: e.addRowAfter
|
|
171
|
+
},
|
|
172
|
+
AddColumnBefore: {
|
|
173
|
+
comp: a,
|
|
174
|
+
props: e.addColumnBefore
|
|
175
|
+
},
|
|
176
|
+
AddColumnAfter: {
|
|
177
|
+
comp: a,
|
|
178
|
+
props: e.addColumnAfter
|
|
179
|
+
},
|
|
180
|
+
DeleteRow: {
|
|
181
|
+
comp: a,
|
|
182
|
+
props: e.deleteRow
|
|
183
|
+
},
|
|
184
|
+
DeleteColumn: {
|
|
185
|
+
comp: a,
|
|
186
|
+
props: e.deleteColumn
|
|
187
|
+
},
|
|
188
|
+
DeleteTable: {
|
|
189
|
+
comp: a,
|
|
190
|
+
props: e.deleteTable
|
|
191
|
+
},
|
|
192
|
+
Print: {
|
|
193
|
+
comp: Oe,
|
|
194
|
+
props: e.print
|
|
195
|
+
},
|
|
196
|
+
Pdf: {
|
|
197
|
+
comp: Te,
|
|
198
|
+
props: e.pdf
|
|
199
|
+
},
|
|
200
|
+
InsertFile: {
|
|
201
|
+
comp: N,
|
|
202
|
+
props: e.insertFile
|
|
203
|
+
},
|
|
204
|
+
FindAndReplace: {
|
|
205
|
+
comp: Pe,
|
|
206
|
+
props: e.findAndReplace
|
|
207
|
+
},
|
|
208
|
+
ForeColor: {
|
|
209
|
+
comp: U,
|
|
210
|
+
props: e.foreColor
|
|
211
|
+
},
|
|
212
|
+
BackColor: {
|
|
213
|
+
comp: U,
|
|
214
|
+
props: e.backColor
|
|
215
|
+
}
|
|
216
|
+
}, wt = /* @__PURE__ */ j({
|
|
217
|
+
name: "KendoEditor",
|
|
218
|
+
emits: {
|
|
219
|
+
focus: null,
|
|
220
|
+
blur: null,
|
|
221
|
+
change: null,
|
|
222
|
+
loaded: null,
|
|
223
|
+
execute: null
|
|
224
|
+
},
|
|
225
|
+
inject: {
|
|
226
|
+
kendoLocalizationService: {
|
|
227
|
+
default: null
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
props: {
|
|
231
|
+
defaultContent: String,
|
|
232
|
+
value: [Object, String],
|
|
233
|
+
defaultEditMode: {
|
|
234
|
+
type: String,
|
|
235
|
+
default: "iframe",
|
|
236
|
+
validator: function(t) {
|
|
237
|
+
return ["iframe", "div"].includes(t);
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
contentStyle: Object,
|
|
241
|
+
dir: String,
|
|
242
|
+
tools: Array,
|
|
243
|
+
keyboardNavigation: {
|
|
244
|
+
type: Boolean,
|
|
245
|
+
default: !0
|
|
246
|
+
},
|
|
247
|
+
resizable: Boolean,
|
|
248
|
+
preserveWhitespace: {
|
|
249
|
+
type: [String, Boolean],
|
|
250
|
+
default: "full",
|
|
251
|
+
validator: function(t) {
|
|
252
|
+
return [!0, !1, "full"].includes(t);
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
pasteHtml: Function,
|
|
256
|
+
extendView: Function,
|
|
257
|
+
ariaDescribedBy: String,
|
|
258
|
+
ariaLabelledBy: String,
|
|
259
|
+
ariaLabel: String
|
|
260
|
+
},
|
|
261
|
+
data() {
|
|
262
|
+
return {
|
|
263
|
+
updateGuid: T(),
|
|
264
|
+
view: void 0,
|
|
265
|
+
linkDialog: !1,
|
|
266
|
+
showLicenseWatermark: !1
|
|
267
|
+
};
|
|
268
|
+
},
|
|
269
|
+
created() {
|
|
270
|
+
this._view = void 0, this.trOnChange = null, this.valueisUpdated = !1, this._prevValue = this.$props.value, Y(x), this.showLicenseWatermark = Z(x);
|
|
271
|
+
},
|
|
272
|
+
mounted() {
|
|
273
|
+
this.iframe = O(this, "iframe"), this.contentElement = O(this, "contentElement"), (!this.iframe || !_) && this.initialize();
|
|
274
|
+
},
|
|
275
|
+
watch: {
|
|
276
|
+
value: function(t, i) {
|
|
277
|
+
this.valueisUpdated = !0, this._prevValue = i;
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
updated() {
|
|
281
|
+
const {
|
|
282
|
+
value: t
|
|
283
|
+
} = this.$props, i = this.getView();
|
|
284
|
+
t === void 0 || !this.valueisUpdated || !i || (ye(i, this.computedValue(), this._prevValue, this.trOnChange, this.htmlOnChange), this.valueisUpdated = !1, this.trOnChange = null, this.htmlOnChange = null);
|
|
285
|
+
},
|
|
286
|
+
unmounted() {
|
|
287
|
+
this.getView() && this.getView().destroy(), this.view = void 0, this._view = void 0;
|
|
288
|
+
},
|
|
289
|
+
render() {
|
|
290
|
+
let t = 100;
|
|
291
|
+
const {
|
|
292
|
+
tools: i = [],
|
|
293
|
+
defaultEditMode: r = "iframe",
|
|
294
|
+
preserveWhitespace: g = "full",
|
|
295
|
+
style: c,
|
|
296
|
+
value: k
|
|
297
|
+
} = this.$props, b = this.getView(), m = Re(this), L = this.showLicenseWatermark ? p(ee, null, null) : null;
|
|
298
|
+
if (this.view) {
|
|
299
|
+
const o = D.getState(this.view.state);
|
|
300
|
+
o.preserveWhitespace = g;
|
|
301
|
+
}
|
|
302
|
+
let h = this.$props.contentStyle;
|
|
303
|
+
h === void 0 && (c || {}).height === void 0 && (h = {
|
|
304
|
+
height: "300px"
|
|
305
|
+
});
|
|
306
|
+
const $ = function() {
|
|
307
|
+
return this.linkDialog && p(be, {
|
|
308
|
+
view: b,
|
|
309
|
+
settings: z,
|
|
310
|
+
dir: this.$props.dir,
|
|
311
|
+
onClose: this.handleClose
|
|
312
|
+
}, null);
|
|
313
|
+
}, s = function(o, u) {
|
|
314
|
+
const l = C[o] || o, G = function() {
|
|
315
|
+
let f;
|
|
316
|
+
return o === "ForeColor" ? f = m.toLanguageString(w.foregroundColorAriaLabel, A[w.foregroundColorAriaLabel]) : o === "BackColor" && (f = m.toLanguageString(w.backgroundColor, A[w.backgroundColor])), f;
|
|
317
|
+
};
|
|
318
|
+
if (C[o]) {
|
|
319
|
+
t++;
|
|
320
|
+
const f = {
|
|
321
|
+
view: b,
|
|
322
|
+
dir: this.$props.dir,
|
|
323
|
+
key: t,
|
|
324
|
+
updateGuid: this.updateGuid,
|
|
325
|
+
settings: C[o].props,
|
|
326
|
+
...C[o].props,
|
|
327
|
+
ariaLabel: G()
|
|
328
|
+
};
|
|
329
|
+
return F(B(C[o].comp), f);
|
|
330
|
+
} else {
|
|
331
|
+
if (l === "Separator")
|
|
332
|
+
return p(X, {
|
|
333
|
+
key: t
|
|
334
|
+
}, null);
|
|
335
|
+
{
|
|
336
|
+
const f = ie.call(this, l.render, oe.call(this));
|
|
337
|
+
return re.call(this, {
|
|
338
|
+
h: F,
|
|
339
|
+
template: f,
|
|
340
|
+
defaultRendering: null,
|
|
341
|
+
additionalListeners: {},
|
|
342
|
+
additionalProps: {
|
|
343
|
+
view: b,
|
|
344
|
+
dir: this.$props.dir,
|
|
345
|
+
updateGuid: this.updateGuid,
|
|
346
|
+
key: t,
|
|
347
|
+
settings: l.props
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}, d = function(o, u) {
|
|
353
|
+
return o.map(function(l) {
|
|
354
|
+
return s.call(this, l, u);
|
|
355
|
+
}, this);
|
|
356
|
+
}, n = i.map(function(o, u) {
|
|
357
|
+
let l;
|
|
358
|
+
return Array.isArray(o) ? p(q, {
|
|
359
|
+
key: u
|
|
360
|
+
}, W(l = d.call(this, o, u)) ? l : {
|
|
361
|
+
default: () => [l]
|
|
362
|
+
}) : s.call(this, o, u);
|
|
363
|
+
}, this);
|
|
364
|
+
return p("div", {
|
|
365
|
+
class: te("k-editor", {
|
|
366
|
+
"k-editor-resizable": this.$props.resizable
|
|
367
|
+
}),
|
|
368
|
+
dir: this.$props.dir
|
|
369
|
+
}, [n.length > 0 && p(Q, {
|
|
370
|
+
class: "k-editor-toolbar",
|
|
371
|
+
keyboardNavigation: this.$props.keyboardNavigation
|
|
372
|
+
}, W(n) ? n : {
|
|
373
|
+
default: () => [n]
|
|
374
|
+
}), r === "iframe" ? p("div", {
|
|
375
|
+
class: "k-editor-content"
|
|
376
|
+
}, [p("iframe", {
|
|
377
|
+
onLoad: this.iframeLoad,
|
|
378
|
+
ref: P(this, "iframe"),
|
|
379
|
+
frameborder: "0",
|
|
380
|
+
title: m.toLanguageString(w.iframeTitle, A[w.iframeTitle]),
|
|
381
|
+
style: h,
|
|
382
|
+
class: "k-iframe"
|
|
383
|
+
}, null)]) : p("div", {
|
|
384
|
+
style: h,
|
|
385
|
+
class: "k-editor-content"
|
|
386
|
+
}, [p("div", {
|
|
387
|
+
ref: P(this, "contentElement"),
|
|
388
|
+
role: "textbox",
|
|
389
|
+
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
390
|
+
"aria-describedby": this.$props.ariaDescribedBy,
|
|
391
|
+
"aria-label": this.$props.ariaLabel
|
|
392
|
+
}, null)]), $.call(this), L]);
|
|
393
|
+
},
|
|
394
|
+
methods: {
|
|
395
|
+
getView() {
|
|
396
|
+
return this.view;
|
|
397
|
+
},
|
|
398
|
+
getHTML() {
|
|
399
|
+
const t = this.getView();
|
|
400
|
+
return t ? y.getHtml(t.state) : "";
|
|
401
|
+
},
|
|
402
|
+
setHTML(t) {
|
|
403
|
+
const i = this.getView();
|
|
404
|
+
i && y.setHtml(i, t);
|
|
405
|
+
},
|
|
406
|
+
focus() {
|
|
407
|
+
this.getView() && this.getView().focus();
|
|
408
|
+
},
|
|
409
|
+
updateTools(t) {
|
|
410
|
+
this.view = t, this.updateGuid = T();
|
|
411
|
+
},
|
|
412
|
+
iframeLoad() {
|
|
413
|
+
_ && this.initialize();
|
|
414
|
+
},
|
|
415
|
+
initialize() {
|
|
416
|
+
const t = this.iframe && this.iframe.contentWindow;
|
|
417
|
+
if (t) {
|
|
418
|
+
const s = t.document;
|
|
419
|
+
[ve, we, this.$props.dir === "rtl" ? ke : void 0].forEach((n) => {
|
|
420
|
+
if (n) {
|
|
421
|
+
const o = s.createElement("style");
|
|
422
|
+
o.appendChild(s.createTextNode(n)), s.head.appendChild(o);
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
const d = s.createElement("meta");
|
|
426
|
+
d.setAttribute("charset", "utf-8"), s.head.appendChild(d), this.contentElement = s.createElement("div"), s.body.appendChild(this.contentElement), this.contentElement.classList.add("k-content"), this.contentElement.setAttribute("role", "main");
|
|
427
|
+
}
|
|
428
|
+
const i = this.contentElement;
|
|
429
|
+
if (!i)
|
|
430
|
+
return;
|
|
431
|
+
const {
|
|
432
|
+
preserveWhitespace: r = "full"
|
|
433
|
+
} = this.$props, g = this;
|
|
434
|
+
let c = [
|
|
435
|
+
// https://prosemirror.net/docs/ref/#state.PluginSpec
|
|
436
|
+
new E({
|
|
437
|
+
view: () => ({
|
|
438
|
+
update: this.updateTools
|
|
439
|
+
}),
|
|
440
|
+
key: new R("toolbar-tools-update-plugin")
|
|
441
|
+
}),
|
|
442
|
+
new E({
|
|
443
|
+
filterTransaction: this.filterTransaction,
|
|
444
|
+
key: new R("onExecute-event-plugin")
|
|
445
|
+
}),
|
|
446
|
+
new E({
|
|
447
|
+
key: D,
|
|
448
|
+
state: {
|
|
449
|
+
init: () => ({
|
|
450
|
+
preserveWhitespace: r
|
|
451
|
+
}),
|
|
452
|
+
apply: (s, d) => d
|
|
453
|
+
}
|
|
454
|
+
}),
|
|
455
|
+
se(),
|
|
456
|
+
ne(),
|
|
457
|
+
ae(),
|
|
458
|
+
le(),
|
|
459
|
+
pe()
|
|
460
|
+
], k = {
|
|
461
|
+
...y.getShortcuts({
|
|
462
|
+
types: {
|
|
463
|
+
listItem: "list_item",
|
|
464
|
+
hardBreak: "hard_break"
|
|
465
|
+
},
|
|
466
|
+
toolsSettings: {
|
|
467
|
+
bold: He,
|
|
468
|
+
italic: De,
|
|
469
|
+
underline: _e
|
|
470
|
+
}
|
|
471
|
+
}),
|
|
472
|
+
"Mod-k": () => {
|
|
473
|
+
const {
|
|
474
|
+
linkDialog: s
|
|
475
|
+
} = this.$data, d = this.getView();
|
|
476
|
+
if (d) {
|
|
477
|
+
const n = d.state, o = n.selection.empty, u = de(n, n.schema.marks[z.mark]);
|
|
478
|
+
!s && !(o && !u) && (this.linkDialog = !0);
|
|
479
|
+
}
|
|
480
|
+
return !s;
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
const {
|
|
484
|
+
defaultContent: b = "",
|
|
485
|
+
value: m
|
|
486
|
+
} = this.$props, L = m && typeof m != "string" ? K(m) : y.createDocument(new ce({
|
|
487
|
+
nodes: ge,
|
|
488
|
+
marks: me
|
|
489
|
+
}), m || b, {
|
|
490
|
+
preserveWhitespace: r
|
|
491
|
+
}), V = {
|
|
492
|
+
state: ue.create({
|
|
493
|
+
plugins: [...c, H(k), H(he)],
|
|
494
|
+
doc: L
|
|
495
|
+
}),
|
|
496
|
+
transformPastedHTML: this.onPasteHtml,
|
|
497
|
+
dispatchTransaction: this.dispatchTransaction,
|
|
498
|
+
handleDOMEvents: {
|
|
499
|
+
focus: this.onFocus,
|
|
500
|
+
blur: this.onBlur,
|
|
501
|
+
paste: this.onPaste
|
|
502
|
+
}
|
|
503
|
+
}, h = {
|
|
504
|
+
plugins: c,
|
|
505
|
+
shortcuts: k,
|
|
506
|
+
target: g,
|
|
507
|
+
viewProps: V,
|
|
508
|
+
dom: i
|
|
509
|
+
};
|
|
510
|
+
this.$emit("loaded", h);
|
|
511
|
+
const $ = this.$props.extendView && this.$props.extendView(h) || new fe({
|
|
512
|
+
mount: i
|
|
513
|
+
}, V);
|
|
514
|
+
this.view = B($);
|
|
515
|
+
},
|
|
516
|
+
filterTransaction(t, i) {
|
|
517
|
+
const r = {
|
|
518
|
+
target: this,
|
|
519
|
+
transaction: t,
|
|
520
|
+
state: i
|
|
521
|
+
};
|
|
522
|
+
return this.$emit("execute", r), !0;
|
|
523
|
+
},
|
|
524
|
+
onPasteHtml(t) {
|
|
525
|
+
if (this.$props.pasteHtml && this.pasteEvent) {
|
|
526
|
+
const i = {
|
|
527
|
+
target: this,
|
|
528
|
+
pastedHtml: t,
|
|
529
|
+
event: this.pasteEvent
|
|
530
|
+
}, r = this.$props.pasteHtml(i);
|
|
531
|
+
if (this.pasteEvent = void 0, typeof r == "string")
|
|
532
|
+
return r;
|
|
533
|
+
}
|
|
534
|
+
return t;
|
|
535
|
+
},
|
|
536
|
+
dispatchTransaction(t) {
|
|
537
|
+
const i = t.docChanged;
|
|
538
|
+
if (i) {
|
|
539
|
+
this.trOnChange = t;
|
|
540
|
+
const r = t.doc, g = t.doc.type.schema, c = this, k = {
|
|
541
|
+
target: c,
|
|
542
|
+
value: r,
|
|
543
|
+
get html() {
|
|
544
|
+
return c.htmlOnChange = y.getHtml({
|
|
545
|
+
doc: r,
|
|
546
|
+
schema: g
|
|
547
|
+
}), c.htmlOnChange;
|
|
548
|
+
},
|
|
549
|
+
transaction: t,
|
|
550
|
+
schema: g
|
|
551
|
+
};
|
|
552
|
+
this.$emit("change", k);
|
|
553
|
+
}
|
|
554
|
+
this.getView() && (this.$props.value === void 0 || !i) && this.getView().updateState(this.getView().state.apply(t));
|
|
555
|
+
},
|
|
556
|
+
onFocus(t, i) {
|
|
557
|
+
const r = {
|
|
558
|
+
target: this,
|
|
559
|
+
event: i
|
|
560
|
+
};
|
|
561
|
+
return this.$emit("focus", r), !1;
|
|
562
|
+
},
|
|
563
|
+
onBlur(t, i) {
|
|
564
|
+
const r = {
|
|
565
|
+
target: this,
|
|
566
|
+
event: i
|
|
567
|
+
};
|
|
568
|
+
return this.$emit("blur", r), !1;
|
|
569
|
+
},
|
|
570
|
+
onPaste(t, i) {
|
|
571
|
+
return this.$props.pasteHtml && (this.pasteEvent = i), !1;
|
|
572
|
+
},
|
|
573
|
+
handleClose() {
|
|
574
|
+
this.linkDialog = !1;
|
|
575
|
+
},
|
|
576
|
+
computedValue() {
|
|
577
|
+
return this.trOnChange !== null ? this.trOnChange.doc : this.$props.value !== void 0 ? this.$props.value : this.getView() ? this.getView().state.doc : this.$props.defaultContent || "";
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
export {
|
|
582
|
+
wt as Editor,
|
|
583
|
+
C as allTools
|
|
584
|
+
};
|