@hkyhy/marsun-components-core 0.1.82 → 0.1.98
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/components/Audit/AuditLogList.d.ts +27 -0
- package/dist/components/Audit/AuditLogList.js +272 -0
- package/dist/components/Audit/AuditLogList.js.map +1 -0
- package/dist/components/Audit/formatAuditCurl.d.ts +27 -0
- package/dist/components/Audit/formatAuditCurl.js +115 -0
- package/dist/components/Audit/formatAuditCurl.js.map +1 -0
- package/dist/components/Audit/formatAuditJson.d.ts +15 -0
- package/dist/components/Audit/formatAuditJson.js +135 -0
- package/dist/components/Audit/formatAuditJson.js.map +1 -0
- package/dist/components/Audit/index.d.ts +3 -0
- package/dist/components/Audit/style.module.scss.js +30 -0
- package/dist/components/Audit/style.module.scss.js.map +1 -0
- package/dist/components/Audit/types.d.ts +39 -0
- package/dist/components/Editor/RichTextEditor/RichTextEditor.d.ts +24 -0
- package/dist/components/Editor/RichTextEditor/RichTextEditor.js +93 -0
- package/dist/components/Editor/RichTextEditor/RichTextEditor.js.map +1 -0
- package/dist/components/Editor/RichTextEditor/index.d.ts +2 -0
- package/dist/components/Editor/RichTextEditor/style.module.scss.js +11 -0
- package/dist/components/Editor/RichTextEditor/style.module.scss.js.map +1 -0
- package/dist/components/Editor/VariablePicker.d.ts +19 -0
- package/dist/components/Editor/VariablePicker.js +55 -0
- package/dist/components/Editor/VariablePicker.js.map +1 -0
- package/dist/components/Editor/index.d.ts +7 -0
- package/dist/components/Editor/index.js +21 -0
- package/dist/components/Editor/index.js.map +1 -0
- package/dist/components/Editor/msgVarTokenPlugin.d.ts +13 -0
- package/dist/components/Editor/msgVarTokenPlugin.js +94 -0
- package/dist/components/Editor/msgVarTokenPlugin.js.map +1 -0
- package/dist/components/Editor/variableMention.d.ts +37 -0
- package/dist/components/Editor/variableMention.js +64 -0
- package/dist/components/Editor/variableMention.js.map +1 -0
- package/dist/components/FormInfo/RichTextField/index.d.ts +21 -0
- package/dist/components/FormInfo/RichTextField/index.js +82 -0
- package/dist/components/FormInfo/RichTextField/index.js.map +1 -0
- package/dist/components/FormInfo/RichTextField/style.module.scss.js +9 -0
- package/dist/components/FormInfo/RichTextField/style.module.scss.js.map +1 -0
- package/dist/components/FormInfo/VariableMentionInput/index.d.ts +17 -0
- package/dist/components/FormInfo/VariableMentionInput/index.js +73 -0
- package/dist/components/FormInfo/VariableMentionInput/index.js.map +1 -0
- package/dist/components/FormInfo/VariableMentionInput/style.module.scss.js +11 -0
- package/dist/components/FormInfo/VariableMentionInput/style.module.scss.js.map +1 -0
- package/dist/components/FormInfo/fields.d.ts +5 -0
- package/dist/components/FormInfo/fields.js +32 -23
- package/dist/components/FormInfo/fields.js.map +1 -1
- package/dist/components/FormInfo/index.d.ts +4 -0
- package/dist/components/StateBar/StateBar.d.ts +19 -6
- package/dist/components/StateBar/StateBar.js +87 -50
- package/dist/components/StateBar/StateBar.js.map +1 -1
- package/dist/components/StateBar/style.module.scss.js +13 -10
- package/dist/components/StateBar/style.module.scss.js.map +1 -1
- package/dist/components/Table/ResizableHeaderCell.js +37 -38
- package/dist/components/Table/ResizableHeaderCell.js.map +1 -1
- package/dist/components/Table/Table.js +88 -89
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/columnConfigUtils.d.ts +1 -1
- package/dist/components/Table/columnConfigUtils.js.map +1 -1
- package/dist/components/Table/style.module.scss.js +34 -34
- package/dist/components/Tools/Inbox/InboxBell/InboxBell.d.ts +45 -0
- package/dist/components/Tools/Inbox/InboxBell/InboxBell.js +156 -0
- package/dist/components/Tools/Inbox/InboxBell/InboxBell.js.map +1 -0
- package/dist/components/Tools/Inbox/InboxBell/index.d.ts +2 -0
- package/dist/components/Tools/Inbox/InboxBell/style.module.scss.js +30 -0
- package/dist/components/Tools/Inbox/InboxBell/style.module.scss.js.map +1 -0
- package/dist/components/Tools/Inbox/index.d.ts +2 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/List/columns.d.ts +8 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/List/columns.js +56 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/List/columns.js.map +1 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/MessageTemplateAdmin.d.ts +8 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/MessageTemplateAdmin.js +216 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/MessageTemplateAdmin.js.map +1 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/Modal/TemplateFormModal.d.ts +26 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/Modal/TemplateFormModal.js +190 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/Modal/TemplateFormModal.js.map +1 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/index.d.ts +3 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/style.module.scss.js +12 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/style.module.scss.js.map +1 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/types.d.ts +76 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/types.js +26 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/types.js.map +1 -0
- package/dist/components/Tools/MessageCenter/index.d.ts +3 -0
- package/dist/components/Tools/MessageCenter/utils/templateCode.d.ts +8 -0
- package/dist/components/Tools/MessageCenter/utils/templateCode.js +25 -0
- package/dist/components/Tools/MessageCenter/utils/templateCode.js.map +1 -0
- package/dist/components/Tools/index.d.ts +5 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/editor.d.ts +5 -0
- package/dist/editor.js +21 -0
- package/dist/editor.js.map +1 -0
- package/dist/form-info.js +33 -29
- package/dist/form-info.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +805 -773
- package/dist/index.js.map +1 -1
- package/dist/marsun-components-core.css +4 -1
- package/dist/node_modules/@ckeditor/ckeditor5-basic-styles/dist/index.js +301 -0
- package/dist/node_modules/@ckeditor/ckeditor5-basic-styles/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js +1256 -0
- package/dist/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-core/dist/index.js +2107 -0
- package/dist/node_modules/@ckeditor/ckeditor5-core/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-editor-classic/dist/index.js +259 -0
- package/dist/node_modules/@ckeditor/ckeditor5-editor-classic/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-engine/dist/index.js +23990 -0
- package/dist/node_modules/@ckeditor/ckeditor5-engine/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-enter/dist/index.js +249 -0
- package/dist/node_modules/@ckeditor/ckeditor5-enter/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-essentials/dist/index.js +47 -0
- package/dist/node_modules/@ckeditor/ckeditor5-essentials/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-font/dist/index.js +100 -0
- package/dist/node_modules/@ckeditor/ckeditor5-font/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-icons/dist/index.js +31 -0
- package/dist/node_modules/@ckeditor/ckeditor5-icons/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-integrations-common/dist/index.js +194 -0
- package/dist/node_modules/@ckeditor/ckeditor5-integrations-common/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-list/dist/index.js +2042 -0
- package/dist/node_modules/@ckeditor/ckeditor5-list/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-mention/dist/index.js +9 -0
- package/dist/node_modules/@ckeditor/ckeditor5-mention/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js +167 -0
- package/dist/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-react/dist/index.js +471 -0
- package/dist/node_modules/@ckeditor/ckeditor5-react/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js +139 -0
- package/dist/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-typing/dist/index.js +755 -0
- package/dist/node_modules/@ckeditor/ckeditor5-typing/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-ui/dist/index.js +7838 -0
- package/dist/node_modules/@ckeditor/ckeditor5-ui/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-ui/node_modules/color-convert/conversions.js +422 -0
- package/dist/node_modules/@ckeditor/ckeditor5-ui/node_modules/color-convert/conversions.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-ui/node_modules/color-convert/index.js +33 -0
- package/dist/node_modules/@ckeditor/ckeditor5-ui/node_modules/color-convert/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-ui/node_modules/color-convert/route.js +47 -0
- package/dist/node_modules/@ckeditor/ckeditor5-ui/node_modules/color-convert/route.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-ui/node_modules/color-name/index.js +156 -0
- package/dist/node_modules/@ckeditor/ckeditor5-ui/node_modules/color-name/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-undo/dist/index.js +313 -0
- package/dist/node_modules/@ckeditor/ckeditor5-undo/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +2942 -0
- package/dist/node_modules/@ckeditor/ckeditor5-utils/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js +892 -0
- package/dist/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js.map +1 -0
- package/dist/node_modules/@ckeditor/ckeditor5-widget/dist/index.js +1047 -0
- package/dist/node_modules/@ckeditor/ckeditor5-widget/dist/index.js.map +1 -0
- package/dist/node_modules/color-parse/node_modules/color-name/index.js +153 -0
- package/dist/node_modules/color-parse/node_modules/color-name/index.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/_internal/globalThis.js +7 -0
- package/dist/node_modules/es-toolkit/dist/_internal/globalThis.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.js +7 -0
- package/dist/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/_internal/isUnsafeToWriteProperty.js +7 -0
- package/dist/node_modules/es-toolkit/dist/_internal/isUnsafeToWriteProperty.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/assignValue.js +9 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/assignValue.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/getSymbols.js +7 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/getSymbols.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/getTag.js +7 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/getTag.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.js +16 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/isIndex.js +15 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/isIndex.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/isKey.js +9 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/isKey.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/isPrototype.js +8 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/isPrototype.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/tags.js +30 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/tags.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/toKey.js +8 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/toKey.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/function/debounce.js +17 -0
- package/dist/node_modules/es-toolkit/dist/compat/function/debounce.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/function/throttle.js +13 -0
- package/dist/node_modules/es-toolkit/dist/compat/function/throttle.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/assignIn.js +17 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/assignIn.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/clone.js +102 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/clone.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeep.js +8 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeep.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.js +33 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/get.js +39 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/get.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/has.js +21 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/has.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/keysIn.js +33 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/keysIn.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/mapValues.js +10 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/mapValues.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/merge.js +9 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/merge.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/mergeWith.js +53 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/mergeWith.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/property.js +10 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/property.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/set.js +9 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/set.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/updateWith.js +31 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/updateWith.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isArguments.js +8 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isArguments.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isArray.js +7 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isArray.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.js +8 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.js +9 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isElement.js +9 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isElement.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.js +15 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isFunction.js +7 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isFunction.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isMatch.js +9 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isMatch.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.js +81 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isObject.js +7 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isObject.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.js +7 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js +16 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isString.js +7 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isString.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isSymbol.js +7 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isSymbol.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.js +8 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/matches.js +9 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/matches.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.js +23 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/util/eq.js +7 -0
- package/dist/node_modules/es-toolkit/dist/compat/util/eq.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/util/iteratee.js +19 -0
- package/dist/node_modules/es-toolkit/dist/compat/util/iteratee.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/util/times.js +11 -0
- package/dist/node_modules/es-toolkit/dist/compat/util/times.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/util/toFinite.js +8 -0
- package/dist/node_modules/es-toolkit/dist/compat/util/toFinite.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/util/toInteger.js +9 -0
- package/dist/node_modules/es-toolkit/dist/compat/util/toInteger.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/util/toNumber.js +8 -0
- package/dist/node_modules/es-toolkit/dist/compat/util/toNumber.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/util/toPath.js +37 -0
- package/dist/node_modules/es-toolkit/dist/compat/util/toPath.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/compat/util/toString.js +15 -0
- package/dist/node_modules/es-toolkit/dist/compat/util/toString.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/function/after.js +11 -0
- package/dist/node_modules/es-toolkit/dist/function/after.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/function/debounce.js +30 -0
- package/dist/node_modules/es-toolkit/dist/function/debounce.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/function/identity.js +7 -0
- package/dist/node_modules/es-toolkit/dist/function/identity.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/function/noop.js +6 -0
- package/dist/node_modules/es-toolkit/dist/function/noop.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/object/clone.js +27 -0
- package/dist/node_modules/es-toolkit/dist/object/clone.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/object/cloneDeep.js +8 -0
- package/dist/node_modules/es-toolkit/dist/object/cloneDeep.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/object/cloneDeepWith.js +121 -0
- package/dist/node_modules/es-toolkit/dist/object/cloneDeepWith.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/object/mapValues.js +12 -0
- package/dist/node_modules/es-toolkit/dist/object/mapValues.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isBuffer.js +8 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isBuffer.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isEqual.js +9 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isEqual.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isEqualWith.js +110 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isEqualWith.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isLength.js +7 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isLength.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isPlainObject.js +9 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isPlainObject.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isPrimitive.js +7 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isPrimitive.js.map +1 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isTypedArray.js +7 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isTypedArray.js.map +1 -0
- package/dist/styles/global.css +4 -1
- package/dist/utils/copyText.d.ts +4 -0
- package/dist/utils/copyText.js +21 -0
- package/dist/utils/copyText.js.map +1 -0
- package/package.json +9 -2
|
@@ -0,0 +1,1047 @@
|
|
|
1
|
+
var j = Object.defineProperty;
|
|
2
|
+
var H = (r, e, t) => e in r ? j(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var E = (r, e, t) => H(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Plugin as F } from "../../ckeditor5-core/dist/index.js";
|
|
5
|
+
import { MouseObserver as U, PointerObserver as $, ModelTreeWalker as q, ModelDocumentSelection as T } from "../../ckeditor5-engine/dist/index.js";
|
|
6
|
+
import { Delete as N } from "../../ckeditor5-typing/dist/index.js";
|
|
7
|
+
import { keyCodes as P, env as k, getLocalizedArrowKeyCodeDirection as G, compareArrays as v, CKEditorError as Y, isForwardArrowKeyCode as z, getRangeFromMouseEvent as J, toArray as M, Rect as Q, EmitterMixin as X } from "../../ckeditor5-utils/dist/index.js";
|
|
8
|
+
import { IconDragHandle as Z, IconReturnArrow as ee } from "../../ckeditor5-icons/dist/index.js";
|
|
9
|
+
import { IconView as te, Template as W } from "../../ckeditor5-ui/dist/index.js";
|
|
10
|
+
import { Enter as ne, _getCopyOnEnterAttributes as I } from "../../ckeditor5-enter/dist/index.js";
|
|
11
|
+
/**
|
|
12
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
13
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
17
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
18
|
+
*/
|
|
19
|
+
const oe = /* @__PURE__ */ X();
|
|
20
|
+
var ie = class extends oe {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
E(this, "_stack", []);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Adds highlight descriptor to the stack.
|
|
27
|
+
*
|
|
28
|
+
* @fires change:top
|
|
29
|
+
*/
|
|
30
|
+
add(e, t) {
|
|
31
|
+
const n = this._stack, o = n[0];
|
|
32
|
+
this._insertDescriptor(e);
|
|
33
|
+
const i = n[0];
|
|
34
|
+
o !== i && !A(o, i) && this.fire("change:top", {
|
|
35
|
+
oldDescriptor: o,
|
|
36
|
+
newDescriptor: i,
|
|
37
|
+
writer: t
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Removes highlight descriptor from the stack.
|
|
42
|
+
*
|
|
43
|
+
* @fires change:top
|
|
44
|
+
* @param id Id of the descriptor to remove.
|
|
45
|
+
*/
|
|
46
|
+
remove(e, t) {
|
|
47
|
+
const n = this._stack, o = n[0];
|
|
48
|
+
this._removeDescriptor(e);
|
|
49
|
+
const i = n[0];
|
|
50
|
+
o !== i && !A(o, i) && this.fire("change:top", {
|
|
51
|
+
oldDescriptor: o,
|
|
52
|
+
newDescriptor: i,
|
|
53
|
+
writer: t
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Inserts a given descriptor in correct place in the stack. It also takes care about updating information
|
|
58
|
+
* when descriptor with same id is already present.
|
|
59
|
+
*/
|
|
60
|
+
_insertDescriptor(e) {
|
|
61
|
+
const t = this._stack, n = t.findIndex((i) => i.id === e.id);
|
|
62
|
+
if (A(e, t[n])) return;
|
|
63
|
+
n > -1 && t.splice(n, 1);
|
|
64
|
+
let o = 0;
|
|
65
|
+
for (; t[o] && re(t[o], e); ) o++;
|
|
66
|
+
t.splice(o, 0, e);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Removes descriptor with given id from the stack.
|
|
70
|
+
*
|
|
71
|
+
* @param id Descriptor's id.
|
|
72
|
+
*/
|
|
73
|
+
_removeDescriptor(e) {
|
|
74
|
+
const t = this._stack, n = t.findIndex((o) => o.id === e);
|
|
75
|
+
n > -1 && t.splice(n, 1);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
function A(r, e) {
|
|
79
|
+
return r && e && r.priority == e.priority && S(r.classes) == S(e.classes);
|
|
80
|
+
}
|
|
81
|
+
function re(r, e) {
|
|
82
|
+
return r.priority > e.priority ? !0 : r.priority < e.priority ? !1 : S(r.classes) > S(e.classes);
|
|
83
|
+
}
|
|
84
|
+
function S(r) {
|
|
85
|
+
return Array.isArray(r) ? r.sort().join(",") : r;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
89
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
90
|
+
*/
|
|
91
|
+
const se = "ck-widget", O = "ck-widget_selected";
|
|
92
|
+
function m(r) {
|
|
93
|
+
return r.is("element") ? !!r.getCustomProperty("widget") : !1;
|
|
94
|
+
}
|
|
95
|
+
function je(r, e, t = {}) {
|
|
96
|
+
if (!r.is("containerElement"))
|
|
97
|
+
throw new Y("widget-to-widget-wrong-element-type", null, { element: r });
|
|
98
|
+
return e.setAttribute("contenteditable", "false", r), e.addClass(se, r), e.setCustomProperty("widget", !0, r), r.getFillerOffset = fe, e.setCustomProperty("widgetLabel", [], r), t.label && de(r, t.label), t.hasSelectionHandle && ge(r, e), ae(r, e), r;
|
|
99
|
+
}
|
|
100
|
+
function ce(r, e, t) {
|
|
101
|
+
if (e.classes && t.addClass(M(e.classes), r), e.attributes) for (const n in e.attributes) t.setAttribute(n, e.attributes[n], r);
|
|
102
|
+
}
|
|
103
|
+
function le(r, e, t) {
|
|
104
|
+
if (e.classes && t.removeClass(M(e.classes), r), e.attributes) for (const n in e.attributes) t.removeAttribute(n, r);
|
|
105
|
+
}
|
|
106
|
+
function ae(r, e, t = ce, n = le) {
|
|
107
|
+
const o = new ie();
|
|
108
|
+
o.on("change:top", (c, l) => {
|
|
109
|
+
l.oldDescriptor && n(r, l.oldDescriptor, l.writer), l.newDescriptor && t(r, l.newDescriptor, l.writer);
|
|
110
|
+
});
|
|
111
|
+
const i = (c, l, a) => o.add(l, a), s = (c, l, a) => o.remove(l, a);
|
|
112
|
+
e.setCustomProperty("addHighlight", i, r), e.setCustomProperty("removeHighlight", s, r);
|
|
113
|
+
}
|
|
114
|
+
function de(r, e) {
|
|
115
|
+
r.getCustomProperty("widgetLabel").push(e);
|
|
116
|
+
}
|
|
117
|
+
function ue(r) {
|
|
118
|
+
return r.getCustomProperty("widgetLabel").reduce((e, t) => typeof t == "function" ? e ? e + ". " + t() : t() : e ? e + ". " + t : t, "");
|
|
119
|
+
}
|
|
120
|
+
function He(r, e) {
|
|
121
|
+
return (t, n) => {
|
|
122
|
+
const { mapper: o, viewPosition: i } = n, s = o.findMappedViewAncestor(i);
|
|
123
|
+
if (!e(s)) return;
|
|
124
|
+
const c = o.toModelElement(s);
|
|
125
|
+
n.modelPosition = r.createPositionAt(c, i.isAtStart ? "before" : "after");
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function fe() {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
function ge(r, e) {
|
|
132
|
+
const t = e.createUIElement("div", { class: "ck ck-widget__selection-handle" }, function(n) {
|
|
133
|
+
const o = this.toDomElement(n), i = new te();
|
|
134
|
+
return i.set("content", Z), i.render(), o.appendChild(i.element), o;
|
|
135
|
+
});
|
|
136
|
+
e.insert(e.createPositionAt(r, 0), t), e.addClass(["ck-widget_with-selection-handle"], r);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
140
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
141
|
+
*/
|
|
142
|
+
const p = "widget-type-around";
|
|
143
|
+
function b(r, e, t) {
|
|
144
|
+
return !!r && m(r) && !t.isInline(e);
|
|
145
|
+
}
|
|
146
|
+
function K(r) {
|
|
147
|
+
return r.closest(".ck-widget__type-around__button");
|
|
148
|
+
}
|
|
149
|
+
function me(r) {
|
|
150
|
+
return r.classList.contains("ck-widget__type-around__button_before") ? "before" : "after";
|
|
151
|
+
}
|
|
152
|
+
function he(r, e) {
|
|
153
|
+
const t = r.closest(".ck-widget");
|
|
154
|
+
return e.mapDomToView(t);
|
|
155
|
+
}
|
|
156
|
+
function w(r) {
|
|
157
|
+
return r.getAttribute(p);
|
|
158
|
+
}
|
|
159
|
+
function pe(r, e) {
|
|
160
|
+
let t = e;
|
|
161
|
+
for (; t && t.is("element") && r.isObject(t); ) t = t.previousSibling;
|
|
162
|
+
if (!(t != null && t.is("element"))) return [];
|
|
163
|
+
if (t.isEmpty) {
|
|
164
|
+
const o = we(t.getAttributes());
|
|
165
|
+
return Array.from(I(r, o));
|
|
166
|
+
}
|
|
167
|
+
const n = t.getChild(t.childCount - 1);
|
|
168
|
+
return r.isInline(n) ? Array.from(I(r, n.getAttributes())) : [];
|
|
169
|
+
}
|
|
170
|
+
function* we(r) {
|
|
171
|
+
for (const [e, t] of r)
|
|
172
|
+
T._isStoreAttributeKey(e) && (yield [T._dropStoreAttributeKeyPrefix(e), t]);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
176
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
177
|
+
*/
|
|
178
|
+
const V = ["before", "after"], be = new DOMParser().parseFromString(ee, "image/svg+xml").firstChild, x = "ck-widget__type-around_disabled";
|
|
179
|
+
var _e = class extends F {
|
|
180
|
+
constructor() {
|
|
181
|
+
super(...arguments);
|
|
182
|
+
/**
|
|
183
|
+
* A reference to the model widget element that has the fake caret active
|
|
184
|
+
* on either side of it. It is later used to remove CSS classes associated with the fake caret
|
|
185
|
+
* when the widget no longer needs it.
|
|
186
|
+
*/
|
|
187
|
+
E(this, "_currentFakeCaretModelElement", null);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* @inheritDoc
|
|
191
|
+
*/
|
|
192
|
+
static get pluginName() {
|
|
193
|
+
return "WidgetTypeAround";
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* @inheritDoc
|
|
197
|
+
*/
|
|
198
|
+
static get isOfficialPlugin() {
|
|
199
|
+
return !0;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* @inheritDoc
|
|
203
|
+
*/
|
|
204
|
+
static get requires() {
|
|
205
|
+
return [ne, N];
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* @inheritDoc
|
|
209
|
+
*/
|
|
210
|
+
init() {
|
|
211
|
+
const e = this.editor, t = e.editing.view;
|
|
212
|
+
this.on("change:isEnabled", (n, o, i) => {
|
|
213
|
+
t.change((s) => {
|
|
214
|
+
for (const c of t.document.roots) i ? s.removeClass(x, c) : s.addClass(x, c);
|
|
215
|
+
}), i || e.model.change((s) => {
|
|
216
|
+
s.removeSelectionAttribute(p);
|
|
217
|
+
});
|
|
218
|
+
}), this._enableTypeAroundUIInjection(), this._enableInsertingParagraphsOnButtonClick(), this._enableInsertingParagraphsOnEnterKeypress(), this._enableInsertingParagraphsOnTypingKeystroke(), this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(), this._enableDeleteIntegration(), this._enableInsertContentIntegration(), this._enableInsertObjectIntegration(), this._enableDeleteContentIntegration();
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* @inheritDoc
|
|
222
|
+
*/
|
|
223
|
+
destroy() {
|
|
224
|
+
super.destroy(), this._currentFakeCaretModelElement = null;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Inserts a new paragraph next to a widget element with the selection anchored in it.
|
|
228
|
+
*
|
|
229
|
+
* **Note**: This method is heavily user-oriented and will both focus the editing view and scroll
|
|
230
|
+
* the viewport to the selection in the inserted paragraph.
|
|
231
|
+
*
|
|
232
|
+
* @param widgetModelElement The model widget element next to which a paragraph is inserted.
|
|
233
|
+
* @param position The position where the paragraph is inserted. Either `'before'` or `'after'` the widget.
|
|
234
|
+
*/
|
|
235
|
+
_insertParagraph(e, t) {
|
|
236
|
+
const n = this.editor, { model: o } = n, { schema: i } = o, s = n.editing.view, c = i.getAttributesWithProperty(e, "copyOnReplace", !0), l = pe(i, e);
|
|
237
|
+
o.change((a) => {
|
|
238
|
+
n.execute("insertParagraph", {
|
|
239
|
+
position: n.model.createPositionAt(e, t),
|
|
240
|
+
attributes: c
|
|
241
|
+
}) && a.setSelectionAttribute(l);
|
|
242
|
+
}), s.focus(), s.scrollToTheSelection();
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* A wrapper for the {@link module:utils/emittermixin~Emitter#listenTo} method that executes the callbacks only
|
|
246
|
+
* when the plugin {@link #isEnabled is enabled}.
|
|
247
|
+
*
|
|
248
|
+
* @param emitter The object that fires the event.
|
|
249
|
+
* @param event The name of the event.
|
|
250
|
+
* @param callback The function to be called on event.
|
|
251
|
+
* @param options Additional options.
|
|
252
|
+
*/
|
|
253
|
+
_listenToIfEnabled(e, t, n, o) {
|
|
254
|
+
this.listenTo(e, t, (...i) => {
|
|
255
|
+
this.isEnabled && n(...i);
|
|
256
|
+
}, o);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Similar to {@link #_insertParagraph}, this method inserts a paragraph except that it
|
|
260
|
+
* does not expect a position. Instead, it performs the insertion next to a selected widget
|
|
261
|
+
* according to the `widget-type-around` model selection attribute value (fake caret position).
|
|
262
|
+
*
|
|
263
|
+
* Because this method requires the `widget-type-around` attribute to be set,
|
|
264
|
+
* the insertion can only happen when the widget's fake caret is active (e.g. activated
|
|
265
|
+
* using the keyboard).
|
|
266
|
+
*
|
|
267
|
+
* @returns Returns `true` when the paragraph was inserted (the attribute was present) and `false` otherwise.
|
|
268
|
+
*/
|
|
269
|
+
_insertParagraphAccordingToFakeCaretPosition() {
|
|
270
|
+
const e = this.editor.model.document.selection, t = w(e);
|
|
271
|
+
if (!t) return !1;
|
|
272
|
+
const n = e.getSelectedElement();
|
|
273
|
+
return this._insertParagraph(n, t), !0;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Creates a listener in the editing conversion pipeline that injects the widget type around
|
|
277
|
+
* UI into every single widget instance created in the editor.
|
|
278
|
+
*
|
|
279
|
+
* The UI is delivered as a {@link module:engine/view/uielement~ViewUIElement}
|
|
280
|
+
* wrapper which renders DOM buttons that users can use to insert paragraphs.
|
|
281
|
+
*/
|
|
282
|
+
_enableTypeAroundUIInjection() {
|
|
283
|
+
const e = this.editor, t = e.model.schema, n = e.locale.t, o = {
|
|
284
|
+
before: n("Insert paragraph before block"),
|
|
285
|
+
after: n("Insert paragraph after block")
|
|
286
|
+
};
|
|
287
|
+
e.editing.downcastDispatcher.on("insert", (i, s, c) => {
|
|
288
|
+
const l = c.mapper.toViewElement(s.item);
|
|
289
|
+
l && b(l, s.item, t) && (ye(c.writer, o, l), l.getCustomProperty("widgetLabel").push(() => this.isEnabled ? n("Press Enter to type after or press Shift + Enter to type before the widget") : ""));
|
|
290
|
+
}, { priority: "low" });
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Brings support for the fake caret that appears when either:
|
|
294
|
+
*
|
|
295
|
+
* * the selection moves to a widget from a position next to it using arrow keys,
|
|
296
|
+
* * the arrow key is pressed when the widget is already selected.
|
|
297
|
+
*
|
|
298
|
+
* The fake caret lets the user know that they can start typing or just press
|
|
299
|
+
* <kbd>Enter</kbd> to insert a paragraph at the position next to a widget as suggested by the fake caret.
|
|
300
|
+
*
|
|
301
|
+
* The fake caret disappears when the user changes the selection or the editor
|
|
302
|
+
* gets blurred.
|
|
303
|
+
*
|
|
304
|
+
* The whole idea is as follows:
|
|
305
|
+
*
|
|
306
|
+
* 1. A user does one of the 2 scenarios described at the beginning.
|
|
307
|
+
* 2. The "keydown" listener is executed and the decision is made whether to show or hide the fake caret.
|
|
308
|
+
* 3. If it should show up, the `widget-type-around` model selection attribute is set indicating
|
|
309
|
+
* on which side of the widget it should appear.
|
|
310
|
+
* 4. The selection dispatcher reacts to the selection attribute and sets CSS classes responsible for the
|
|
311
|
+
* fake caret on the view widget.
|
|
312
|
+
* 5. If the fake caret should disappear, the selection attribute is removed and the dispatcher
|
|
313
|
+
* does the CSS class clean-up in the view.
|
|
314
|
+
* 6. Additionally, `change:range` and `FocusTracker#isFocused` listeners also remove the selection
|
|
315
|
+
* attribute (the former also removes widget CSS classes).
|
|
316
|
+
*/
|
|
317
|
+
_enableTypeAroundFakeCaretActivationUsingKeyboardArrows() {
|
|
318
|
+
const e = this.editor, t = e.model, n = t.document.selection, o = t.schema, i = e.editing.view;
|
|
319
|
+
this._listenToIfEnabled(i.document, "arrowKey", (c, l) => {
|
|
320
|
+
this._handleArrowKeyPress(c, l);
|
|
321
|
+
}, {
|
|
322
|
+
context: [m, "$text"],
|
|
323
|
+
priority: "high"
|
|
324
|
+
}), this._listenToIfEnabled(n, "change:range", (c, l) => {
|
|
325
|
+
l.directChange && e.model.change((a) => {
|
|
326
|
+
a.removeSelectionAttribute(p);
|
|
327
|
+
});
|
|
328
|
+
}), this._listenToIfEnabled(t.document, "change:data", () => {
|
|
329
|
+
const c = n.getSelectedElement();
|
|
330
|
+
if (c) {
|
|
331
|
+
const l = e.editing.mapper.toViewElement(c);
|
|
332
|
+
if (b(l, c, o)) return;
|
|
333
|
+
}
|
|
334
|
+
e.model.change((l) => {
|
|
335
|
+
l.removeSelectionAttribute(p);
|
|
336
|
+
});
|
|
337
|
+
}), this._listenToIfEnabled(e.editing.downcastDispatcher, "selection", (c, l, a) => {
|
|
338
|
+
const f = a.writer;
|
|
339
|
+
if (this._currentFakeCaretModelElement) {
|
|
340
|
+
const h = a.mapper.toViewElement(this._currentFakeCaretModelElement);
|
|
341
|
+
h && (f.removeClass(V.map(s), h), this._currentFakeCaretModelElement = null);
|
|
342
|
+
}
|
|
343
|
+
const u = l.selection.getSelectedElement();
|
|
344
|
+
if (!u) return;
|
|
345
|
+
const d = a.mapper.toViewElement(u);
|
|
346
|
+
if (!b(d, u, o)) return;
|
|
347
|
+
const g = w(l.selection);
|
|
348
|
+
g && (f.addClass(s(g), d), this._currentFakeCaretModelElement = u);
|
|
349
|
+
}), this._listenToIfEnabled(e.ui.focusTracker, "change:isFocused", (c, l, a) => {
|
|
350
|
+
a || e.model.change((f) => {
|
|
351
|
+
f.removeSelectionAttribute(p);
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
function s(c) {
|
|
355
|
+
return `ck-widget_type-around_show-fake-caret_${c}`;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* A listener executed on each "keydown" in the view document, a part of
|
|
360
|
+
* {@link #_enableTypeAroundFakeCaretActivationUsingKeyboardArrows}.
|
|
361
|
+
*
|
|
362
|
+
* It decides whether the arrow keypress should activate the fake caret or not (also whether it should
|
|
363
|
+
* be deactivated).
|
|
364
|
+
*
|
|
365
|
+
* The fake caret activation is done by setting the `widget-type-around` model selection attribute
|
|
366
|
+
* in this listener, and stopping and preventing the event that would normally be handled by the widget
|
|
367
|
+
* plugin that is responsible for the regular keyboard navigation near/across all widgets (that
|
|
368
|
+
* includes inline widgets, which are ignored by the widget type around plugin).
|
|
369
|
+
*/
|
|
370
|
+
_handleArrowKeyPress(e, t) {
|
|
371
|
+
const n = this.editor, o = n.model, i = o.document.selection, s = o.schema, c = n.editing.view;
|
|
372
|
+
if (t.shiftKey) return;
|
|
373
|
+
const l = t.keyCode, a = z(l, n.locale.contentLanguageDirection), f = c.document.selection.getSelectedElement(), u = n.editing.mapper.toModelElement(f);
|
|
374
|
+
let d;
|
|
375
|
+
/* v8 ignore else -- @preserve */
|
|
376
|
+
b(f, u, s) ? d = this._handleArrowKeyPressOnSelectedWidget(a) : i.isCollapsed ? d = this._handleArrowKeyPressWhenSelectionNextToAWidget(a) : t.shiftKey || (d = this._handleArrowKeyPressWhenNonCollapsedSelection(a)), d && (t.preventDefault(), e.stop());
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Handles the keyboard navigation on "keydown" when a widget is currently selected and activates or deactivates
|
|
380
|
+
* the fake caret for that widget, depending on the current value of the `widget-type-around` model
|
|
381
|
+
* selection attribute and the direction of the pressed arrow key.
|
|
382
|
+
*
|
|
383
|
+
* @param isForward `true` when the pressed arrow key was responsible for the forward model selection movement
|
|
384
|
+
* as in {@link module:utils/keyboard~isForwardArrowKeyCode}.
|
|
385
|
+
* @returns Returns `true` when the keypress was handled and no other keydown listener of the editor should
|
|
386
|
+
* process the event any further. Returns `false` otherwise.
|
|
387
|
+
*/
|
|
388
|
+
_handleArrowKeyPressOnSelectedWidget(e) {
|
|
389
|
+
const t = this.editor.model, n = t.document.selection, o = w(n);
|
|
390
|
+
return t.change((i) => {
|
|
391
|
+
if (o) {
|
|
392
|
+
if (o !== (e ? "after" : "before"))
|
|
393
|
+
return i.removeSelectionAttribute(p), !0;
|
|
394
|
+
} else
|
|
395
|
+
return i.setSelectionAttribute(p, e ? "after" : "before"), !0;
|
|
396
|
+
return !1;
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Handles the keyboard navigation on "keydown" when **no** widget is selected but the selection is **directly** next
|
|
401
|
+
* to one and upon the fake caret should become active for this widget upon arrow keypress
|
|
402
|
+
* (AKA entering/selecting the widget).
|
|
403
|
+
*
|
|
404
|
+
* **Note**: This code mirrors the implementation from the widget plugin but also adds the selection attribute.
|
|
405
|
+
* Unfortunately, there is no safe way to let the widget plugin do the selection part first and then just set the
|
|
406
|
+
* selection attribute here in the widget type around plugin. This is why this code must duplicate some from the widget plugin.
|
|
407
|
+
*
|
|
408
|
+
* @param isForward `true` when the pressed arrow key was responsible for the forward model selection movement
|
|
409
|
+
* as in {@link module:utils/keyboard~isForwardArrowKeyCode}.
|
|
410
|
+
* @returns Returns `true` when the keypress was handled and no other keydown listener of the editor should
|
|
411
|
+
* process the event any further. Returns `false` otherwise.
|
|
412
|
+
*/
|
|
413
|
+
_handleArrowKeyPressWhenSelectionNextToAWidget(e) {
|
|
414
|
+
const t = this.editor, n = t.model, o = n.schema, i = t.plugins.get("Widget"), s = i._getObjectElementNextToSelection(e), c = t.editing.mapper.toViewElement(s);
|
|
415
|
+
return b(c, s, o) ? (n.change((l) => {
|
|
416
|
+
i._setSelectionOverElement(s), l.setSelectionAttribute(p, e ? "before" : "after");
|
|
417
|
+
}), !0) : !1;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Handles the keyboard navigation on "keydown" when a widget is currently selected (together with some other content)
|
|
421
|
+
* and the widget is the first or last element in the selection. It activates or deactivates the fake caret for that widget.
|
|
422
|
+
*
|
|
423
|
+
* @param isForward `true` when the pressed arrow key was responsible for the forward model selection movement
|
|
424
|
+
* as in {@link module:utils/keyboard~isForwardArrowKeyCode}.
|
|
425
|
+
* @returns Returns `true` when the keypress was handled and no other keydown listener of the editor should
|
|
426
|
+
* process the event any further. Returns `false` otherwise.
|
|
427
|
+
*/
|
|
428
|
+
_handleArrowKeyPressWhenNonCollapsedSelection(e) {
|
|
429
|
+
const t = this.editor, n = t.model, o = n.schema, i = t.editing.mapper, s = n.document.selection, c = e ? s.getLastPosition().nodeBefore : s.getFirstPosition().nodeAfter, l = i.toViewElement(c);
|
|
430
|
+
return b(l, c, o) ? (n.change((a) => {
|
|
431
|
+
a.setSelection(c, "on"), a.setSelectionAttribute(p, e ? "after" : "before");
|
|
432
|
+
}), !0) : !1;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Registers a `mousedown` listener for the view document which intercepts events
|
|
436
|
+
* coming from the widget type around UI, which happens when a user clicks one of the buttons
|
|
437
|
+
* that insert a paragraph next to a widget.
|
|
438
|
+
*/
|
|
439
|
+
_enableInsertingParagraphsOnButtonClick() {
|
|
440
|
+
const e = this.editor, t = e.editing.view;
|
|
441
|
+
this._listenToIfEnabled(t.document, "mousedown", (n, o) => {
|
|
442
|
+
const i = K(o.domTarget);
|
|
443
|
+
if (!i) return;
|
|
444
|
+
const s = me(i), c = he(i, t.domConverter), l = e.editing.mapper.toModelElement(c);
|
|
445
|
+
this._insertParagraph(l, s), o.preventDefault(), n.stop();
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Creates the <kbd>Enter</kbd> key listener on the view document that allows the user to insert a paragraph
|
|
450
|
+
* near the widget when either:
|
|
451
|
+
*
|
|
452
|
+
* * The fake caret was first activated using the arrow keys,
|
|
453
|
+
* * The entire widget is selected in the model.
|
|
454
|
+
*
|
|
455
|
+
* In the first case, the new paragraph is inserted according to the `widget-type-around` selection
|
|
456
|
+
* attribute (see {@link #_handleArrowKeyPress}).
|
|
457
|
+
*
|
|
458
|
+
* In the second case, the new paragraph is inserted based on whether a soft (<kbd>Shift</kbd>+<kbd>Enter</kbd>) keystroke
|
|
459
|
+
* was pressed or not.
|
|
460
|
+
*/
|
|
461
|
+
_enableInsertingParagraphsOnEnterKeypress() {
|
|
462
|
+
const e = this.editor, t = e.model.document.selection, n = e.editing.view;
|
|
463
|
+
this._listenToIfEnabled(n.document, "enter", (o, i) => {
|
|
464
|
+
if (o.eventPhase != "atTarget") return;
|
|
465
|
+
const s = t.getSelectedElement(), c = e.editing.mapper.toViewElement(s), l = e.model.schema;
|
|
466
|
+
let a;
|
|
467
|
+
this._insertParagraphAccordingToFakeCaretPosition() ? a = !0 : b(c, s, l) && (this._insertParagraph(s, i.isSoft ? "before" : "after"), a = !0), a && (i.preventDefault(), o.stop());
|
|
468
|
+
}, { context: m });
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Similar to the {@link #_enableInsertingParagraphsOnEnterKeypress}, it allows the user
|
|
472
|
+
* to insert a paragraph next to a widget when the fake caret was activated using arrow
|
|
473
|
+
* keys but it responds to typing instead of <kbd>Enter</kbd>.
|
|
474
|
+
*
|
|
475
|
+
* Listener enabled by this method will insert a new paragraph according to the `widget-type-around`
|
|
476
|
+
* model selection attribute as the user simply starts typing, which creates the impression that the fake caret
|
|
477
|
+
* behaves like a real one rendered by the browser (AKA your text appears where the caret was).
|
|
478
|
+
*
|
|
479
|
+
* **Note**: At the moment this listener creates 2 undo steps: one for the `insertParagraph` command
|
|
480
|
+
* and another one for actual typing. It is not a disaster but this may need to be fixed
|
|
481
|
+
* sooner or later.
|
|
482
|
+
*/
|
|
483
|
+
_enableInsertingParagraphsOnTypingKeystroke() {
|
|
484
|
+
const e = this.editor.editing.view.document;
|
|
485
|
+
this._listenToIfEnabled(e, "insertText", (t, n) => {
|
|
486
|
+
this._insertParagraphAccordingToFakeCaretPosition() && (n.selection = e.selection);
|
|
487
|
+
}, { priority: "high" }), k.isAndroid ? this._listenToIfEnabled(e, "keydown", (t, n) => {
|
|
488
|
+
n.keyCode == 229 && this._insertParagraphAccordingToFakeCaretPosition();
|
|
489
|
+
}) : this._listenToIfEnabled(e, "compositionstart", () => {
|
|
490
|
+
this._insertParagraphAccordingToFakeCaretPosition();
|
|
491
|
+
}, { priority: "highest" });
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* It creates a "delete" event listener on the view document to handle cases when the <kbd>Delete</kbd> or <kbd>Backspace</kbd>
|
|
495
|
+
* is pressed and the fake caret is currently active.
|
|
496
|
+
*
|
|
497
|
+
* The fake caret should create an illusion of a real browser caret so that when it appears before or after
|
|
498
|
+
* a widget, pressing <kbd>Delete</kbd> or <kbd>Backspace</kbd> should remove a widget or delete the content
|
|
499
|
+
* before or after a widget (depending on the content surrounding the widget).
|
|
500
|
+
*/
|
|
501
|
+
_enableDeleteIntegration() {
|
|
502
|
+
const e = this.editor, t = e.editing.view, n = e.model, o = n.schema;
|
|
503
|
+
this._listenToIfEnabled(t.document, "delete", (i, s) => {
|
|
504
|
+
if (i.eventPhase != "atTarget") return;
|
|
505
|
+
const c = w(n.document.selection);
|
|
506
|
+
if (!c) return;
|
|
507
|
+
const l = s.direction, a = n.document.selection.getSelectedElement(), f = c === "before", u = l == "forward";
|
|
508
|
+
if (f === u) e.execute("delete", { selection: n.createSelection(a, "on") });
|
|
509
|
+
else {
|
|
510
|
+
const d = o.getNearestSelectionRange(n.createPositionAt(a, c), l);
|
|
511
|
+
if (d) if (!d.isCollapsed) n.change((g) => {
|
|
512
|
+
g.setSelection(d), e.execute(u ? "deleteForward" : "delete");
|
|
513
|
+
});
|
|
514
|
+
else {
|
|
515
|
+
const g = n.createSelection(d.start);
|
|
516
|
+
if (n.modifySelection(g, { direction: l }), !g.focus.isEqual(d.start)) n.change((h) => {
|
|
517
|
+
h.setSelection(d), e.execute(u ? "deleteForward" : "delete");
|
|
518
|
+
});
|
|
519
|
+
else {
|
|
520
|
+
const h = Ae(o, d.start.parent);
|
|
521
|
+
n.deleteContent(n.createSelection(h, "on"), { doNotAutoparagraph: !0 });
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
s.preventDefault(), i.stop();
|
|
526
|
+
}, { context: m });
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Attaches the {@link module:engine/model/model~Model#event:insertContent} event listener that, for instance, allows the user to paste
|
|
530
|
+
* content near a widget when the fake caret is first activated using the arrow keys.
|
|
531
|
+
*
|
|
532
|
+
* The content is inserted according to the `widget-type-around` selection attribute (see {@link #_handleArrowKeyPress}).
|
|
533
|
+
*/
|
|
534
|
+
_enableInsertContentIntegration() {
|
|
535
|
+
const e = this.editor, t = this.editor.model, n = t.document.selection;
|
|
536
|
+
this._listenToIfEnabled(e.model, "insertContent", (o, [i, s]) => {
|
|
537
|
+
if (s && !s.is("documentSelection")) return;
|
|
538
|
+
const c = w(n);
|
|
539
|
+
if (c)
|
|
540
|
+
return o.stop(), t.change((l) => {
|
|
541
|
+
const a = n.getSelectedElement(), f = t.createPositionAt(a, c), u = l.createSelection(f), d = t.insertContent(i, u);
|
|
542
|
+
return l.setSelection(u), d;
|
|
543
|
+
});
|
|
544
|
+
}, { priority: "high" });
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Attaches the {@link module:engine/model/model~Model#event:insertObject} event listener that modifies the
|
|
548
|
+
* `options.findOptimalPosition`parameter to position of fake caret in relation to selected element
|
|
549
|
+
* to reflect user's intent of desired insertion position.
|
|
550
|
+
*
|
|
551
|
+
* The object is inserted according to the `widget-type-around` selection attribute (see {@link #_handleArrowKeyPress}).
|
|
552
|
+
*/
|
|
553
|
+
_enableInsertObjectIntegration() {
|
|
554
|
+
const e = this.editor, t = this.editor.model.document.selection;
|
|
555
|
+
this._listenToIfEnabled(e.model, "insertObject", (n, o) => {
|
|
556
|
+
const [, i, s = {}] = o;
|
|
557
|
+
if (i && !i.is("documentSelection")) return;
|
|
558
|
+
const c = w(t);
|
|
559
|
+
c && (s.findOptimalPosition = c, o[3] = s);
|
|
560
|
+
}, { priority: "high" });
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Attaches the {@link module:engine/model/model~Model#event:deleteContent} event listener to block the event when the fake
|
|
564
|
+
* caret is active.
|
|
565
|
+
*
|
|
566
|
+
* This is required for cases that trigger {@link module:engine/model/model~Model#deleteContent `model.deleteContent()`}
|
|
567
|
+
* before calling {@link module:engine/model/model~Model#insertContent `model.insertContent()`} like, for instance,
|
|
568
|
+
* plain text pasting.
|
|
569
|
+
*/
|
|
570
|
+
_enableDeleteContentIntegration() {
|
|
571
|
+
const e = this.editor, t = this.editor.model.document.selection;
|
|
572
|
+
this._listenToIfEnabled(e.model, "deleteContent", (n, [o]) => {
|
|
573
|
+
o && !o.is("documentSelection") || w(t) && n.stop();
|
|
574
|
+
}, { priority: "high" });
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
function ye(r, e, t) {
|
|
578
|
+
const n = r.createUIElement("div", { class: "ck ck-reset_all ck-widget__type-around" }, function(o) {
|
|
579
|
+
const i = this.toDomElement(o);
|
|
580
|
+
return Ee(i, e), Se(i), i;
|
|
581
|
+
});
|
|
582
|
+
r.insert(r.createPositionAt(t, "end"), n);
|
|
583
|
+
}
|
|
584
|
+
function Ee(r, e) {
|
|
585
|
+
for (const t of V) {
|
|
586
|
+
const n = new W({
|
|
587
|
+
tag: "div",
|
|
588
|
+
attributes: {
|
|
589
|
+
class: [
|
|
590
|
+
"ck",
|
|
591
|
+
"ck-widget__type-around__button",
|
|
592
|
+
`ck-widget__type-around__button_${t}`
|
|
593
|
+
],
|
|
594
|
+
title: e[t],
|
|
595
|
+
"aria-hidden": "true"
|
|
596
|
+
},
|
|
597
|
+
children: [r.ownerDocument.importNode(be, !0)]
|
|
598
|
+
});
|
|
599
|
+
r.appendChild(n.render());
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
function Se(r) {
|
|
603
|
+
const e = new W({
|
|
604
|
+
tag: "div",
|
|
605
|
+
attributes: { class: ["ck", "ck-widget__type-around__fake-caret"] }
|
|
606
|
+
});
|
|
607
|
+
r.appendChild(e.render());
|
|
608
|
+
}
|
|
609
|
+
function Ae(r, e) {
|
|
610
|
+
let t = e;
|
|
611
|
+
for (const n of e.getAncestors({ parentFirst: !0 })) {
|
|
612
|
+
if (n.childCount > 1 || r.isLimit(n)) break;
|
|
613
|
+
t = n;
|
|
614
|
+
}
|
|
615
|
+
return t;
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
619
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
620
|
+
*/
|
|
621
|
+
function Pe(r) {
|
|
622
|
+
const e = r.model;
|
|
623
|
+
return (t, n) => {
|
|
624
|
+
const o = n.keyCode == P.arrowup, i = n.keyCode == P.arrowdown, s = n.shiftKey, c = e.document.selection;
|
|
625
|
+
if (!o && !i) return;
|
|
626
|
+
const l = i, a = ke(r, c, l);
|
|
627
|
+
if (a) {
|
|
628
|
+
if (a.isCollapsed) {
|
|
629
|
+
if (c.isCollapsed) return;
|
|
630
|
+
if (s) return;
|
|
631
|
+
}
|
|
632
|
+
(a.isCollapsed || Ce(r, a, l)) && (e.change((f) => {
|
|
633
|
+
const u = l ? a.end : a.start;
|
|
634
|
+
if (s) {
|
|
635
|
+
const d = e.createSelection(c.anchor);
|
|
636
|
+
d.setFocus(u), f.setSelection(d);
|
|
637
|
+
} else f.setSelection(u);
|
|
638
|
+
}), t.stop(), n.preventDefault(), n.stopPropagation());
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
function ke(r, e, t) {
|
|
643
|
+
const n = r.model;
|
|
644
|
+
if (t) {
|
|
645
|
+
const o = e.focus, i = D(n, o, "forward");
|
|
646
|
+
if (!i) return;
|
|
647
|
+
const s = n.createRange(o, i), c = R(n.schema, s, "backward");
|
|
648
|
+
/* v8 ignore else -- @preserve */
|
|
649
|
+
if (c) return n.createRange(o, c);
|
|
650
|
+
} else {
|
|
651
|
+
const o = e.focus, i = D(n, o, "backward");
|
|
652
|
+
if (!i) return;
|
|
653
|
+
const s = n.createRange(i, o), c = R(n.schema, s, "forward");
|
|
654
|
+
/* v8 ignore else -- @preserve */
|
|
655
|
+
if (c) return n.createRange(c, o);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
function D(r, e, t) {
|
|
659
|
+
const n = r.schema, o = r.createRangeIn(e.root), i = t == "forward" ? "elementStart" : "elementEnd";
|
|
660
|
+
for (const { previousPosition: s, item: c, type: l } of o.getWalker({
|
|
661
|
+
startPosition: e,
|
|
662
|
+
direction: t
|
|
663
|
+
})) {
|
|
664
|
+
if (n.isLimit(c) && !n.isInline(c)) return s;
|
|
665
|
+
if (l == i && n.isBlock(c)) return null;
|
|
666
|
+
}
|
|
667
|
+
return null;
|
|
668
|
+
}
|
|
669
|
+
function R(r, e, t) {
|
|
670
|
+
const n = t == "backward" ? e.end : e.start;
|
|
671
|
+
if (r.checkChild(n, "$text")) return n;
|
|
672
|
+
for (const { nextPosition: o } of e.getWalker({ direction: t })) if (r.checkChild(o, "$text")) return o;
|
|
673
|
+
}
|
|
674
|
+
function Ce(r, e, t) {
|
|
675
|
+
const n = r.model, o = r.view.domConverter;
|
|
676
|
+
if (t) {
|
|
677
|
+
const a = n.createSelection(e.start);
|
|
678
|
+
n.modifySelection(a), !a.focus.isAtEnd && !e.start.isEqual(a.focus) && (e = n.createRange(a.focus, e.end));
|
|
679
|
+
}
|
|
680
|
+
const i = r.mapper.toViewRange(e), s = o.viewRangeToDom(i), c = Q.getDomRangeRects(s);
|
|
681
|
+
let l;
|
|
682
|
+
for (const a of c) {
|
|
683
|
+
if (l === void 0) {
|
|
684
|
+
l = Math.round(a.bottom);
|
|
685
|
+
continue;
|
|
686
|
+
}
|
|
687
|
+
if (Math.round(a.top) >= l) return !1;
|
|
688
|
+
l = Math.max(l, Math.round(a.bottom));
|
|
689
|
+
}
|
|
690
|
+
return !0;
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
694
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
695
|
+
*/
|
|
696
|
+
var Ue = class extends F {
|
|
697
|
+
constructor() {
|
|
698
|
+
super(...arguments);
|
|
699
|
+
/**
|
|
700
|
+
* Holds previously selected widgets.
|
|
701
|
+
*/
|
|
702
|
+
E(this, "_previouslySelected", /* @__PURE__ */ new Set());
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* @inheritDoc
|
|
706
|
+
*/
|
|
707
|
+
static get pluginName() {
|
|
708
|
+
return "Widget";
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* @inheritDoc
|
|
712
|
+
*/
|
|
713
|
+
static get isOfficialPlugin() {
|
|
714
|
+
return !0;
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* @inheritDoc
|
|
718
|
+
*/
|
|
719
|
+
static get requires() {
|
|
720
|
+
return [_e, N];
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* @inheritDoc
|
|
724
|
+
*/
|
|
725
|
+
init() {
|
|
726
|
+
const e = this.editor, t = e.editing.view, n = t.document, o = e.t;
|
|
727
|
+
this.editor.editing.downcastDispatcher.on("selection", (i, s, c) => {
|
|
728
|
+
const l = c.writer, a = s.selection;
|
|
729
|
+
if (a.isCollapsed) return;
|
|
730
|
+
const f = a.getSelectedElement();
|
|
731
|
+
if (!f) return;
|
|
732
|
+
const u = e.editing.mapper.toViewElement(f);
|
|
733
|
+
m(u) && c.consumable.consume(a, "selection") && l.setSelection(l.createRangeOn(u), {
|
|
734
|
+
fake: !0,
|
|
735
|
+
label: ue(u)
|
|
736
|
+
});
|
|
737
|
+
}), this.editor.editing.downcastDispatcher.on("selection", (i, s, c) => {
|
|
738
|
+
this._clearPreviouslySelectedWidgets(c.writer);
|
|
739
|
+
const l = c.writer, a = l.document.selection;
|
|
740
|
+
let f = null;
|
|
741
|
+
for (const u of a.getRanges()) for (const d of u) {
|
|
742
|
+
const g = d.item;
|
|
743
|
+
m(g) && !xe(g, f) && (l.addClass(O, g), this._previouslySelected.add(g), f = g);
|
|
744
|
+
}
|
|
745
|
+
}, { priority: "low" }), t.addObserver(U), t.addObserver($), this.listenTo(n, "mousedown", (...i) => this._onMousedown(...i)), this.listenTo(n, "pointerdown", (...i) => this._onPointerdown(...i)), this.listenTo(n, "arrowKey", (...i) => {
|
|
746
|
+
this._handleSelectionChangeOnArrowKeyPress(...i);
|
|
747
|
+
}, { context: [m, "$text"] }), this.listenTo(n, "arrowKey", (...i) => {
|
|
748
|
+
this._preventDefaultOnArrowKeyPress(...i);
|
|
749
|
+
}, { context: "$root" }), this.listenTo(n, "arrowKey", Pe(this.editor.editing), { context: "$text" }), this.listenTo(n, "delete", (i, s) => {
|
|
750
|
+
this._handleDelete(s.direction == "forward") && (s.preventDefault(), i.stop());
|
|
751
|
+
}, { context: "$root" }), this.listenTo(n, "tab", (i, s) => {
|
|
752
|
+
this._selectNextEditable(s.shiftKey ? "backward" : "forward") && (t.scrollToTheSelection(), s.preventDefault(), i.stop());
|
|
753
|
+
}, {
|
|
754
|
+
context: (i) => m(i) || i.is("editableElement"),
|
|
755
|
+
priority: "low"
|
|
756
|
+
}), this.listenTo(n, "keydown", (i, s) => {
|
|
757
|
+
s.keystroke == P.esc && this._selectAncestorWidget() && (s.preventDefault(), i.stop());
|
|
758
|
+
}, {
|
|
759
|
+
context: (i) => i.is("editableElement"),
|
|
760
|
+
priority: "low"
|
|
761
|
+
}), e.accessibility.addKeystrokeInfoGroup({
|
|
762
|
+
id: "widget",
|
|
763
|
+
label: o("Keystrokes that can be used when a widget is selected (for example: image, table, etc.)"),
|
|
764
|
+
keystrokes: [
|
|
765
|
+
{
|
|
766
|
+
label: o("Move focus from an editable area back to the parent widget"),
|
|
767
|
+
keystroke: "Esc"
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
label: o("Insert a new paragraph directly after a widget"),
|
|
771
|
+
keystroke: "Enter"
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
label: o("Insert a new paragraph directly before a widget"),
|
|
775
|
+
keystroke: "Shift+Enter"
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
label: o("Move the caret to allow typing directly before a widget"),
|
|
779
|
+
keystroke: [["arrowup"], ["arrowleft"]]
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
label: o("Move the caret to allow typing directly after a widget"),
|
|
783
|
+
keystroke: [["arrowdown"], ["arrowright"]]
|
|
784
|
+
}
|
|
785
|
+
]
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Handles {@link module:engine/view/document~ViewDocument#event:mousedown mousedown} events on widget elements.
|
|
790
|
+
*/
|
|
791
|
+
_onMousedown(e, t) {
|
|
792
|
+
const n = t.target;
|
|
793
|
+
n && t.domEvent.detail >= 3 && this._selectBlockContent(n) && t.preventDefault();
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Handles {@link module:engine/view/document~ViewDocument#event:pointerdown pointerdown} events on widget elements.
|
|
797
|
+
*/
|
|
798
|
+
_onPointerdown(e, t) {
|
|
799
|
+
if (!t.domEvent.isPrimary || K(t.domTarget)) return;
|
|
800
|
+
const n = this.editor, o = n.editing.view, i = o.document;
|
|
801
|
+
let s = t.target;
|
|
802
|
+
if (!s) return;
|
|
803
|
+
if (!m(s)) {
|
|
804
|
+
const l = Ie(s);
|
|
805
|
+
if (!l) return;
|
|
806
|
+
if (m(l)) s = l;
|
|
807
|
+
else {
|
|
808
|
+
const a = Oe(o, t);
|
|
809
|
+
if (a && m(a)) s = a;
|
|
810
|
+
else return;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
(k.isAndroid || k.isiOS) && t.preventDefault(), i.isFocused || o.focus();
|
|
814
|
+
const c = n.editing.mapper.toModelElement(s);
|
|
815
|
+
this._setSelectionOverElement(c);
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Selects entire block content, e.g. on triple click it selects entire paragraph.
|
|
819
|
+
*/
|
|
820
|
+
_selectBlockContent(e) {
|
|
821
|
+
const t = this.editor, n = t.model, o = t.editing.mapper, i = n.schema, s = o.findMappedViewAncestor(this.editor.editing.view.createPositionAt(e, 0)), c = De(o.toModelElement(s), n.schema);
|
|
822
|
+
return c ? (n.change((l) => {
|
|
823
|
+
const a = i.isLimit(c) ? null : Re(l.createPositionAfter(c), i), f = l.createPositionAt(c, 0), u = a ? l.createPositionAt(a, 0) : l.createPositionAt(c, "end");
|
|
824
|
+
l.setSelection(l.createRange(f, u));
|
|
825
|
+
}), !0) : !1;
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* Handles {@link module:engine/view/document~ViewDocument#event:keydown keydown} events and changes
|
|
829
|
+
* the model selection when:
|
|
830
|
+
*
|
|
831
|
+
* * arrow key is pressed when the widget is selected,
|
|
832
|
+
* * the selection is next to a widget and the widget should become selected upon the arrow key press.
|
|
833
|
+
*
|
|
834
|
+
* See {@link #_preventDefaultOnArrowKeyPress}.
|
|
835
|
+
*/
|
|
836
|
+
_handleSelectionChangeOnArrowKeyPress(e, t) {
|
|
837
|
+
const n = t.keyCode, o = this.editor.model, i = o.schema, s = o.document.selection, c = s.getSelectedElement(), l = G(n, this.editor.locale.contentLanguageDirection), a = l == "down" || l == "right", f = l == "up" || l == "down";
|
|
838
|
+
if (!t.shiftKey && !s.isCollapsed) {
|
|
839
|
+
if (Te(s, i)) {
|
|
840
|
+
const y = a ? s.getLastPosition() : s.getFirstPosition(), C = i.getNearestSelectionRange(y, a ? "forward" : "backward");
|
|
841
|
+
C && (o.change((L) => {
|
|
842
|
+
L.setSelection(C);
|
|
843
|
+
}), t.preventDefault(), e.stop());
|
|
844
|
+
}
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
const u = ve(o, a), d = o.createSelection(u);
|
|
848
|
+
if (o.modifySelection(d, { direction: a ? "forward" : "backward" }), d.isEqual(u)) return;
|
|
849
|
+
d.focus.isTouching(u.focus) && i.checkChild(d.focus.parent, "$text") && (a ? !d.focus.isAtEnd : !d.focus.isAtStart) && o.modifySelection(d, { direction: a ? "forward" : "backward" });
|
|
850
|
+
const g = a ? u.focus.nodeBefore : u.focus.nodeAfter, h = d.focus.nodeBefore, B = d.focus.nodeAfter, _ = a ? h : B;
|
|
851
|
+
if (t.shiftKey)
|
|
852
|
+
(c && i.isObject(c) || _ && i.isObject(_) || g && i.isObject(g)) && (o.change((y) => {
|
|
853
|
+
y.setSelection(d);
|
|
854
|
+
}), t.preventDefault(), e.stop());
|
|
855
|
+
else if (_ && i.isObject(_)) {
|
|
856
|
+
if (i.isInline(_) && f) return;
|
|
857
|
+
o.change((y) => {
|
|
858
|
+
y.setSelection(_, "on");
|
|
859
|
+
}), t.preventDefault(), e.stop();
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* Handles {@link module:engine/view/document~ViewDocument#event:keydown keydown} events and prevents
|
|
864
|
+
* the default browser behavior to make sure the fake selection is not being moved from a fake selection
|
|
865
|
+
* container.
|
|
866
|
+
*
|
|
867
|
+
* See {@link #_handleSelectionChangeOnArrowKeyPress}.
|
|
868
|
+
*/
|
|
869
|
+
_preventDefaultOnArrowKeyPress(e, t) {
|
|
870
|
+
const n = this.editor.model, o = n.schema, i = n.document.selection.getSelectedElement();
|
|
871
|
+
i && o.isObject(i) && (t.preventDefault(), e.stop());
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* Handles delete keys: backspace and delete.
|
|
875
|
+
*
|
|
876
|
+
* @param isForward Set to true if delete was performed in forward direction.
|
|
877
|
+
* @returns Returns `true` if keys were handled correctly.
|
|
878
|
+
*/
|
|
879
|
+
_handleDelete(e) {
|
|
880
|
+
const t = this.editor.model.document.selection;
|
|
881
|
+
if (!this.editor.model.canEditAt(t) || !t.isCollapsed) return;
|
|
882
|
+
const n = this._getObjectElementNextToSelection(e);
|
|
883
|
+
if (n)
|
|
884
|
+
return this.editor.model.change((o) => {
|
|
885
|
+
let i = t.anchor.parent;
|
|
886
|
+
for (; i.isEmpty; ) {
|
|
887
|
+
const s = i;
|
|
888
|
+
i = s.parent, o.remove(s);
|
|
889
|
+
}
|
|
890
|
+
this._setSelectionOverElement(n);
|
|
891
|
+
}), !0;
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Sets {@link module:engine/model/selection~ModelSelection document's selection} over given element.
|
|
895
|
+
*
|
|
896
|
+
* @internal
|
|
897
|
+
*/
|
|
898
|
+
_setSelectionOverElement(e) {
|
|
899
|
+
this.editor.model.change((t) => {
|
|
900
|
+
t.setSelection(t.createRangeOn(e));
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
/**
|
|
904
|
+
* Checks if {@link module:engine/model/element~ModelElement element} placed next to the current
|
|
905
|
+
* {@link module:engine/model/selection~ModelSelection model selection} exists and is marked in
|
|
906
|
+
* {@link module:engine/model/schema~ModelSchema schema} as `object`.
|
|
907
|
+
*
|
|
908
|
+
* @internal
|
|
909
|
+
* @param forward Direction of checking.
|
|
910
|
+
*/
|
|
911
|
+
_getObjectElementNextToSelection(e) {
|
|
912
|
+
const t = this.editor.model, n = t.schema, o = t.document.selection, i = t.createSelection(o);
|
|
913
|
+
if (t.modifySelection(i, { direction: e ? "forward" : "backward" }), i.isEqual(o)) return null;
|
|
914
|
+
const s = e ? i.focus.nodeBefore : i.focus.nodeAfter;
|
|
915
|
+
return s && n.isObject(s) ? s : null;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Removes CSS class from previously selected widgets.
|
|
919
|
+
*/
|
|
920
|
+
_clearPreviouslySelectedWidgets(e) {
|
|
921
|
+
for (const t of this._previouslySelected) e.removeClass(O, t);
|
|
922
|
+
this._previouslySelected.clear();
|
|
923
|
+
}
|
|
924
|
+
/**
|
|
925
|
+
* Moves the document selection into the next editable or block widget.
|
|
926
|
+
*/
|
|
927
|
+
_selectNextEditable(e) {
|
|
928
|
+
const t = this.editor.editing, n = t.view, o = this.editor.model, i = n.document.selection, s = o.document.selection;
|
|
929
|
+
let c;
|
|
930
|
+
if (s.rangeCount > 1) {
|
|
931
|
+
const a = s.isBackward ? s.getFirstRange() : s.getLastRange();
|
|
932
|
+
c = t.mapper.toViewPosition(e == "forward" ? a.end : a.start);
|
|
933
|
+
} else c = e == "forward" ? i.getFirstPosition() : i.getLastPosition();
|
|
934
|
+
const l = this._findNextFocusRange(c, e);
|
|
935
|
+
return l ? (o.change((a) => {
|
|
936
|
+
a.setSelection(l);
|
|
937
|
+
}), !0) : !1;
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* Looks for next focus point in the document starting from the given view position and direction.
|
|
941
|
+
* The focus point is either a block widget or an editable.
|
|
942
|
+
*
|
|
943
|
+
* @internal
|
|
944
|
+
*/
|
|
945
|
+
_findNextFocusRange(e, t) {
|
|
946
|
+
const n = this.editor.editing, o = n.view, i = this.editor.model, s = o.document.selection, c = s.editableElement, l = c.getPath();
|
|
947
|
+
let a = s.getSelectedElement();
|
|
948
|
+
a && !m(a) && (a = null);
|
|
949
|
+
const f = t == "forward" ? o.createRange(e, o.createPositionAt(e.root, "end")) : o.createRange(o.createPositionAt(e.root, 0), e);
|
|
950
|
+
for (const { nextPosition: u } of f.getWalker({ direction: t })) {
|
|
951
|
+
const d = u.parent;
|
|
952
|
+
if (m(d) && d != a) {
|
|
953
|
+
const g = n.mapper.toModelElement(d);
|
|
954
|
+
if (!i.schema.isBlock(g)) continue;
|
|
955
|
+
if (v(l, d.getPath()) != "extension") return i.createRangeOn(g);
|
|
956
|
+
} else if (d.is("editableElement")) {
|
|
957
|
+
if (d == c && !a) continue;
|
|
958
|
+
const g = n.mapper.toModelPosition(u), h = i.schema.getNearestSelectionRange(g, t);
|
|
959
|
+
if (!h) continue;
|
|
960
|
+
return d == c && a ? h : v(l, d.getPath()) != "extension" ? i.createRangeIn(i.schema.getLimitElement(h)) : h;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
return null;
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* Updates the document selection so that it selects first ancestor widget.
|
|
967
|
+
*/
|
|
968
|
+
_selectAncestorWidget() {
|
|
969
|
+
const e = this.editor, t = e.editing.mapper, n = e.editing.view.document.selection.getFirstPosition().parent, o = (n.is("$text") ? n.parent : n).findAncestor(m);
|
|
970
|
+
if (!o) return !1;
|
|
971
|
+
const i = t.toModelElement(o);
|
|
972
|
+
return i ? (e.model.change((s) => {
|
|
973
|
+
s.setSelection(i, "on");
|
|
974
|
+
}), !0) : !1;
|
|
975
|
+
}
|
|
976
|
+
};
|
|
977
|
+
function Te(r, e) {
|
|
978
|
+
const t = r.getFirstPosition(), n = r.getLastPosition(), o = t.nodeAfter, i = n.nodeBefore;
|
|
979
|
+
return !!o && e.isObject(o) || !!i && e.isObject(i);
|
|
980
|
+
}
|
|
981
|
+
function ve(r, e) {
|
|
982
|
+
const t = r.document.selection, n = t.getSelectedElement(), o = w(t);
|
|
983
|
+
return n && o == "before" ? r.createSelection(n, "before") : n && o == "after" ? r.createSelection(n, "after") : r.createSelection(t.getRanges(), { backward: n && r.schema.isObject(n) ? !e : t.isBackward });
|
|
984
|
+
}
|
|
985
|
+
function Ie(r) {
|
|
986
|
+
let e = r;
|
|
987
|
+
for (; e; ) {
|
|
988
|
+
if (e.is("editableElement") || m(e)) return e;
|
|
989
|
+
e = e.parent;
|
|
990
|
+
}
|
|
991
|
+
return null;
|
|
992
|
+
}
|
|
993
|
+
function Oe(r, e) {
|
|
994
|
+
const t = J(e.domEvent);
|
|
995
|
+
let n;
|
|
996
|
+
if (t ? n = r.domConverter.domRangeToView(t) : n = r.createRange(r.createPositionAt(e.target, 0)), !n) return null;
|
|
997
|
+
const o = n.start;
|
|
998
|
+
if (!o.parent) return null;
|
|
999
|
+
let i = o.parent;
|
|
1000
|
+
if (o.parent.is("editableElement")) {
|
|
1001
|
+
/* v8 ignore else -- @preserve */
|
|
1002
|
+
o.isAtEnd && o.nodeBefore ? i = o.nodeBefore : o.isAtStart && o.nodeAfter && (i = o.nodeAfter);
|
|
1003
|
+
}
|
|
1004
|
+
return i.is("$text") ? i.parent : i;
|
|
1005
|
+
}
|
|
1006
|
+
function xe(r, e) {
|
|
1007
|
+
return e ? Array.from(r.getAncestors()).includes(e) : !1;
|
|
1008
|
+
}
|
|
1009
|
+
function De(r, e) {
|
|
1010
|
+
for (const t of r.getAncestors({
|
|
1011
|
+
includeSelf: !0,
|
|
1012
|
+
parentFirst: !0
|
|
1013
|
+
})) {
|
|
1014
|
+
if (e.checkChild(t, "$text")) return t;
|
|
1015
|
+
if (e.isLimit(t) && !e.isObject(t)) break;
|
|
1016
|
+
}
|
|
1017
|
+
return null;
|
|
1018
|
+
}
|
|
1019
|
+
function Re(r, e) {
|
|
1020
|
+
const t = new q({ startPosition: r });
|
|
1021
|
+
for (const { item: n } of t) {
|
|
1022
|
+
if (e.isLimit(n) || !n.is("element")) return null;
|
|
1023
|
+
if (e.checkChild(n, "$text")) return n;
|
|
1024
|
+
}
|
|
1025
|
+
return null;
|
|
1026
|
+
}
|
|
1027
|
+
export {
|
|
1028
|
+
se as WIDGET_CLASS_NAME,
|
|
1029
|
+
O as WIDGET_SELECTED_CLASS_NAME,
|
|
1030
|
+
Ue as Widget,
|
|
1031
|
+
ie as WidgetHighlightStack,
|
|
1032
|
+
_e as WidgetTypeAround,
|
|
1033
|
+
p as _WIDGET_TYPE_AROUND_SELECTION_ATTRIBUTE,
|
|
1034
|
+
K as _getClosestWidgetTypeAroundDomButton,
|
|
1035
|
+
he as _getClosestWidgetViewElement,
|
|
1036
|
+
me as _getWidgetTypeAroundButtonPosition,
|
|
1037
|
+
w as _getWidgetTypeAroundFakeCaretPosition,
|
|
1038
|
+
ue as getLabel,
|
|
1039
|
+
b as isTypeAroundWidget,
|
|
1040
|
+
m as isWidget,
|
|
1041
|
+
ae as setHighlightHandling,
|
|
1042
|
+
de as setLabel,
|
|
1043
|
+
je as toWidget,
|
|
1044
|
+
Pe as verticalWidgetNavigationHandler,
|
|
1045
|
+
He as viewToModelPositionOutsideModelElement
|
|
1046
|
+
};
|
|
1047
|
+
//# sourceMappingURL=index.js.map
|