@umbraco-cms/backoffice 14.0.0--preview004-b3446294 → 14.0.0--preview003
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-cms/apps/app/app.element.js +3 -0
- package/dist-cms/assets/lang/da-dk.js +0 -3
- package/dist-cms/assets/lang/da-dk.ts +0 -3
- package/dist-cms/assets/lang/en-us.js +18 -21
- package/dist-cms/assets/lang/en-us.ts +18 -21
- package/dist-cms/custom-elements.json +19 -288
- package/dist-cms/external/tinymce/index.js +36 -36
- package/dist-cms/mocks/browser-handlers.js +1 -1
- package/dist-cms/mocks/data/entity.data.d.ts +1 -1
- package/dist-cms/mocks/data/entity.data.js +9 -1
- package/dist-cms/mocks/data/media.data.d.ts +1 -2
- package/dist-cms/mocks/data/media.data.js +0 -11
- package/dist-cms/mocks/data/user-groups.data.d.ts +9 -0
- package/dist-cms/mocks/data/user-groups.data.js +21 -0
- package/dist-cms/mocks/data/users.data.d.ts +16 -0
- package/dist-cms/mocks/data/{user.data.js → users.data.js} +41 -27
- package/dist-cms/mocks/handlers/dictionary.handlers.js +2 -2
- package/dist-cms/mocks/handlers/media.handlers.js +0 -8
- package/dist-cms/mocks/handlers/partial-views.handlers.js +3 -3
- package/dist-cms/mocks/handlers/user-group.handlers.js +17 -0
- package/dist-cms/mocks/handlers/user.handlers.js +1 -15
- package/dist-cms/packages/core/components/input-list-base/input-list-base.js +1 -1
- package/dist-cms/packages/core/components/input-section/input-section.element.d.ts +2 -2
- package/dist-cms/packages/core/components/input-section/input-section.element.js +5 -5
- package/dist-cms/packages/core/extension-registry/conditions/types.d.ts +2 -3
- package/dist-cms/packages/core/extension-registry/models/index.d.ts +1 -5
- package/dist-cms/packages/core/extension-registry/models/index.js +0 -2
- package/dist-cms/packages/core/localization/index.d.ts +0 -3
- package/dist-cms/packages/core/localization/index.js +0 -3
- package/dist-cms/packages/core/localization/localize.element.js +1 -1
- package/dist-cms/packages/core/modal/common/manifests.js +0 -6
- package/dist-cms/packages/core/modal/common/tree-picker/tree-picker-modal.element.js +3 -5
- package/dist-cms/packages/core/modal/token/index.d.ts +0 -1
- package/dist-cms/packages/core/modal/token/index.js +0 -1
- package/dist-cms/packages/core/picker-input/picker-input.context.js +3 -1
- package/dist-cms/packages/core/tree/tree.context.js +2 -3
- package/dist-cms/packages/documents/documents/components/index.d.ts +0 -1
- package/dist-cms/packages/documents/documents/components/index.js +0 -1
- package/dist-cms/packages/documents/documents/components/input-document/input-document.element.d.ts +12 -7
- package/dist-cms/packages/documents/documents/components/input-document/input-document.element.js +64 -51
- package/dist-cms/packages/documents/documents/entity-actions/create/manifests.js +0 -9
- package/dist-cms/packages/documents/documents/entity-actions/manifests.js +1 -1
- package/dist-cms/packages/documents/documents/entity-actions/permissions.action.d.ts +1 -2
- package/dist-cms/packages/documents/documents/entity-actions/permissions.action.js +2 -22
- package/dist-cms/packages/documents/documents/index.d.ts +0 -2
- package/dist-cms/packages/documents/documents/index.js +0 -2
- package/dist-cms/packages/documents/documents/manifests.d.ts +0 -4
- package/dist-cms/packages/documents/documents/manifests.js +0 -2
- package/dist-cms/packages/documents/documents/recycle-bin/entity-action/manifests.d.ts +0 -4
- package/dist-cms/packages/documents/documents/recycle-bin/entity-action/manifests.js +0 -6
- package/dist-cms/packages/documents/documents/recycle-bin/manifests.d.ts +0 -4
- package/dist-cms/packages/documents/documents/repository/document.repository.js +4 -4
- package/dist-cms/packages/documents/documents/repository/manifests.d.ts +2 -3
- package/dist-cms/packages/documents/documents/repository/manifests.js +1 -9
- package/dist-cms/packages/documents/documents/workspace/views/info/document-info-workspace-view.element.js +28 -29
- package/dist-cms/packages/documents/manifests.d.ts +0 -4
- package/dist-cms/packages/log-viewer/workspace/views/overview/components/log-viewer-saved-searches-overview.element.js +1 -1
- package/dist-cms/packages/media/manifests.d.ts +1 -2
- package/dist-cms/packages/media/manifests.js +0 -1
- package/dist-cms/packages/media/media/components/index.d.ts +0 -1
- package/dist-cms/packages/media/media/components/index.js +0 -1
- package/dist-cms/packages/media/media/components/input-media/input-media.element.d.ts +15 -7
- package/dist-cms/packages/media/media/components/input-media/input-media.element.js +72 -50
- package/dist-cms/packages/media/media/index.d.ts +0 -2
- package/dist-cms/packages/media/media/index.js +1 -1
- package/dist-cms/packages/media/media/manifests.d.ts +1 -1
- package/dist-cms/packages/media/media/manifests.js +0 -2
- package/dist-cms/packages/media/media/repository/manifests.d.ts +2 -3
- package/dist-cms/packages/media/media/repository/manifests.js +1 -9
- package/dist-cms/packages/media/media/repository/media.repository.d.ts +0 -6
- package/dist-cms/packages/media/media/repository/media.repository.js +0 -22
- package/dist-cms/packages/users/current-user/index.d.ts +0 -1
- package/dist-cms/packages/users/current-user/index.js +0 -1
- package/dist-cms/packages/users/current-user/manifests.js +1 -7
- package/dist-cms/packages/users/current-user/modals/current-user/current-user-modal.element.js +7 -7
- package/dist-cms/packages/users/index.d.ts +2 -4
- package/dist-cms/packages/users/index.js +2 -4
- package/dist-cms/packages/users/manifests.d.ts +0 -2
- package/dist-cms/packages/users/manifests.js +0 -3
- package/dist-cms/packages/users/user-groups/collection/user-group-collection-header.element.js +2 -2
- package/dist-cms/packages/users/user-groups/collection/user-group-collection-view.element.js +6 -6
- package/dist-cms/packages/users/user-groups/components/index.d.ts +0 -1
- package/dist-cms/packages/users/user-groups/components/index.js +0 -1
- package/dist-cms/packages/users/user-groups/index.d.ts +0 -2
- package/dist-cms/packages/users/user-groups/index.js +0 -2
- package/dist-cms/packages/users/user-groups/manifests.d.ts +1 -1
- package/dist-cms/packages/users/user-groups/manifests.js +0 -2
- package/dist-cms/packages/users/user-groups/workspace/user-group-workspace-editor.element.d.ts +0 -2
- package/dist-cms/packages/users/user-groups/workspace/user-group-workspace-editor.element.js +56 -57
- package/dist-cms/packages/users/user-groups/workspace/user-group-workspace.context.d.ts +0 -12
- package/dist-cms/packages/users/user-groups/workspace/user-group-workspace.context.js +0 -20
- package/dist-cms/packages/users/user-groups/workspace/user-group-workspace.element.js +1 -1
- package/dist-cms/packages/users/users/collection/user-collection-header.element.js +11 -18
- package/dist-cms/packages/users/users/collection/views/grid/user-collection-grid-view.element.js +6 -6
- package/dist-cms/packages/users/users/collection/views/table/column-layouts/status/user-table-status-column-layout.element.js +3 -3
- package/dist-cms/packages/users/users/components/index.d.ts +0 -3
- package/dist-cms/packages/users/users/components/index.js +0 -3
- package/dist-cms/packages/users/users/components/user-input/user-input.element.js +2 -2
- package/dist-cms/packages/users/users/index.d.ts +0 -2
- package/dist-cms/packages/users/users/index.js +0 -2
- package/dist-cms/packages/users/users/modals/user-picker/user-picker-modal.element.d.ts +1 -3
- package/dist-cms/packages/users/users/modals/user-picker/user-picker-modal.element.js +25 -20
- package/dist-cms/packages/users/users/repository/user.repository.js +1 -1
- package/dist-cms/packages/users/users/workspace/user-workspace-editor.element.js +56 -73
- package/dist-cms/packages/users/utils.d.ts +2 -5
- package/dist-cms/packages/users/utils.js +14 -14
- package/dist-cms/shared/auth/auth-flow.d.ts +4 -0
- package/dist-cms/shared/auth/auth-flow.js +25 -6
- package/dist-cms/shared/repository/repository-items.manager.js +0 -5
- package/dist-cms/shared/umb-events/index.d.ts +0 -1
- package/dist-cms/shared/umb-events/index.js +0 -1
- package/dist-cms/tinymce/CHANGELOG.md +0 -48
- package/dist-cms/tinymce/composer.json +1 -1
- package/dist-cms/tinymce/models/dom/model.js +1 -1
- package/dist-cms/tinymce/models/dom/model.min.js +1 -1
- package/dist-cms/tinymce/package.json +1 -1
- package/dist-cms/tinymce/plugins/accordion/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/accordion/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/advlist/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/advlist/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/anchor/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/anchor/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/autolink/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/autolink/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/autoresize/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/autoresize/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/autosave/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/autosave/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/charmap/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/charmap/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/code/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/code/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/codesample/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/codesample/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/directionality/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/directionality/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/emoticons/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/emoticons/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/fullscreen/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/fullscreen/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/help/plugin.js +5 -5
- package/dist-cms/tinymce/plugins/help/plugin.min.js +2 -2
- package/dist-cms/tinymce/plugins/image/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/image/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/importcss/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/importcss/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/insertdatetime/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/insertdatetime/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/link/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/link/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/lists/plugin.js +8 -63
- package/dist-cms/tinymce/plugins/lists/plugin.min.js +2 -2
- package/dist-cms/tinymce/plugins/media/plugin.js +23 -3
- package/dist-cms/tinymce/plugins/media/plugin.min.js +2 -2
- package/dist-cms/tinymce/plugins/nonbreaking/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/nonbreaking/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/pagebreak/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/pagebreak/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/preview/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/preview/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/quickbars/plugin.js +4 -13
- package/dist-cms/tinymce/plugins/quickbars/plugin.min.js +2 -2
- package/dist-cms/tinymce/plugins/save/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/save/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/searchreplace/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/searchreplace/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/table/plugin.js +2 -2
- package/dist-cms/tinymce/plugins/table/plugin.min.js +2 -2
- package/dist-cms/tinymce/plugins/template/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/template/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/visualblocks/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/visualblocks/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/visualchars/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/visualchars/plugin.min.js +1 -1
- package/dist-cms/tinymce/plugins/wordcount/plugin.js +1 -1
- package/dist-cms/tinymce/plugins/wordcount/plugin.min.js +1 -1
- package/dist-cms/tinymce/skins/ui/oxide/content.css +1 -1
- package/dist-cms/tinymce/skins/ui/oxide/content.inline.css +1 -1
- package/dist-cms/tinymce/skins/ui/oxide/content.inline.min.css +1 -1
- package/dist-cms/tinymce/skins/ui/oxide/content.min.css +1 -1
- package/dist-cms/tinymce/skins/ui/oxide/skin.css +11 -51
- package/dist-cms/tinymce/skins/ui/oxide/skin.min.css +1 -1
- package/dist-cms/tinymce/skins/ui/oxide-dark/content.css +1 -1
- package/dist-cms/tinymce/skins/ui/oxide-dark/content.inline.css +1 -1
- package/dist-cms/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -1
- package/dist-cms/tinymce/skins/ui/oxide-dark/content.min.css +1 -1
- package/dist-cms/tinymce/skins/ui/oxide-dark/skin.css +14 -54
- package/dist-cms/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
- package/dist-cms/tinymce/skins/ui/tinymce-5/content.css +1 -1
- package/dist-cms/tinymce/skins/ui/tinymce-5/content.inline.css +1 -1
- package/dist-cms/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -1
- package/dist-cms/tinymce/skins/ui/tinymce-5/content.min.css +1 -1
- package/dist-cms/tinymce/skins/ui/tinymce-5/skin.css +11 -51
- package/dist-cms/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
- package/dist-cms/tinymce/skins/ui/tinymce-5-dark/content.css +1 -1
- package/dist-cms/tinymce/skins/ui/tinymce-5-dark/content.inline.css +1 -1
- package/dist-cms/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -1
- package/dist-cms/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -1
- package/dist-cms/tinymce/skins/ui/tinymce-5-dark/skin.css +11 -51
- package/dist-cms/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
- package/dist-cms/tinymce/themes/silver/theme.js +55 -158
- package/dist-cms/tinymce/themes/silver/theme.min.js +2 -2
- package/dist-cms/tinymce/tinymce.d.ts +6 -4
- package/dist-cms/tinymce/tinymce.js +644 -864
- package/dist-cms/tinymce/tinymce.min.js +2 -2
- package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
- package/dist-cms/umbraco-package-schema.json +0 -154
- package/dist-cms/vscode-html-custom-data.json +18 -167
- package/package.json +2 -2
- package/dist-cms/mocks/data/user-group.data.d.ts +0 -17
- package/dist-cms/mocks/data/user-group.data.js +0 -61
- package/dist-cms/mocks/data/user.data.d.ts +0 -15
- package/dist-cms/mocks/handlers/user-group/collection.handlers.d.ts +0 -1
- package/dist-cms/mocks/handlers/user-group/collection.handlers.js +0 -10
- package/dist-cms/mocks/handlers/user-group/detail.handlers.d.ts +0 -1
- package/dist-cms/mocks/handlers/user-group/detail.handlers.js +0 -37
- package/dist-cms/mocks/handlers/user-group/index.js +0 -4
- package/dist-cms/mocks/handlers/user-group/item.handlers.d.ts +0 -1
- package/dist-cms/mocks/handlers/user-group/item.handlers.js +0 -13
- package/dist-cms/mocks/handlers/user-group/slug.d.ts +0 -1
- package/dist-cms/mocks/handlers/user-group/slug.js +0 -1
- package/dist-cms/packages/core/extension-registry/models/user-granular-permission.model.d.ts +0 -8
- package/dist-cms/packages/core/extension-registry/models/user-granular-permission.model.js +0 -1
- package/dist-cms/packages/core/extension-registry/models/user-permission.model.d.ts +0 -11
- package/dist-cms/packages/core/extension-registry/models/user-permission.model.js +0 -1
- package/dist-cms/packages/core/localization/localize-date.element.d.ts +0 -28
- package/dist-cms/packages/core/localization/localize-date.element.js +0 -42
- package/dist-cms/packages/core/localization/localize-number.element.d.ts +0 -28
- package/dist-cms/packages/core/localization/localize-number.element.js +0 -42
- package/dist-cms/packages/core/localization/localize-relative-time.element.d.ts +0 -34
- package/dist-cms/packages/core/localization/localize-relative-time.element.js +0 -54
- package/dist-cms/packages/core/modal/common/entity-user-permission-settings/entity-user-permission-settings-modal.element.d.ts +0 -19
- package/dist-cms/packages/core/modal/common/entity-user-permission-settings/entity-user-permission-settings-modal.element.js +0 -97
- package/dist-cms/packages/core/modal/token/entity-user-permission-settings-modal.token.d.ts +0 -7
- package/dist-cms/packages/core/modal/token/entity-user-permission-settings-modal.token.js +0 -4
- package/dist-cms/packages/documents/documents/components/input-document/input-document.context.d.ts +0 -6
- package/dist-cms/packages/documents/documents/components/input-document/input-document.context.js +0 -7
- package/dist-cms/packages/documents/documents/components/input-document-granular-permission/input-document-granular-permission.element.d.ts +0 -23
- package/dist-cms/packages/documents/documents/components/input-document-granular-permission/input-document-granular-permission.element.js +0 -102
- package/dist-cms/packages/documents/documents/user-permissions/index.d.ts +0 -1
- package/dist-cms/packages/documents/documents/user-permissions/index.js +0 -1
- package/dist-cms/packages/documents/documents/user-permissions/manifests.d.ts +0 -19
- package/dist-cms/packages/documents/documents/user-permissions/manifests.js +0 -196
- package/dist-cms/packages/media/media/components/input-media/input-media.context.d.ts +0 -6
- package/dist-cms/packages/media/media/components/input-media/input-media.context.js +0 -7
- package/dist-cms/packages/media/media/repository/media-item.store.d.ts +0 -20
- package/dist-cms/packages/media/media/repository/media-item.store.js +0 -23
- package/dist-cms/packages/media/media/repository/sources/media-item.server.data.d.ts +0 -24
- package/dist-cms/packages/media/media/repository/sources/media-item.server.data.js +0 -31
- package/dist-cms/packages/media/media/user-permissions/index.d.ts +0 -1
- package/dist-cms/packages/media/media/user-permissions/index.js +0 -1
- package/dist-cms/packages/media/media/user-permissions/manifests.d.ts +0 -4
- package/dist-cms/packages/media/media/user-permissions/manifests.js +0 -27
- package/dist-cms/packages/users/current-user/conditions/index.d.ts +0 -1
- package/dist-cms/packages/users/current-user/conditions/index.js +0 -1
- package/dist-cms/packages/users/current-user/conditions/user-permission.condition.d.ts +0 -18
- package/dist-cms/packages/users/current-user/conditions/user-permission.condition.js +0 -23
- package/dist-cms/packages/users/user-groups/entity-actions/manifests.d.ts +0 -2
- package/dist-cms/packages/users/user-groups/entity-actions/manifests.js +0 -19
- package/dist-cms/packages/users/user-groups/workspace/components/user-group-default-permission-list.element.d.ts +0 -16
- package/dist-cms/packages/users/user-groups/workspace/components/user-group-default-permission-list.element.js +0 -69
- package/dist-cms/packages/users/user-groups/workspace/components/user-group-granular-permission-list.element.d.ts +0 -14
- package/dist-cms/packages/users/user-groups/workspace/components/user-group-granular-permission-list.element.js +0 -31
- package/dist-cms/packages/users/users/components/user-permission-setting/user-permission-setting.element.d.ts +0 -15
- package/dist-cms/packages/users/users/components/user-permission-setting/user-permission-setting.element.js +0 -66
- package/dist-cms/packages/users/users/repository/index.d.ts +0 -1
- package/dist-cms/packages/users/users/repository/index.js +0 -1
- package/dist-cms/shared/umb-events/selected.event.d.ts +0 -3
- package/dist-cms/shared/umb-events/selected.event.js +0 -6
- /package/dist-cms/mocks/handlers/{user-group/index.d.ts → user-group.handlers.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TinyMCE version 6.
|
|
2
|
+
* TinyMCE version 6.6.1 (2023-08-02)
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
(function () {
|
|
@@ -960,26 +960,26 @@
|
|
|
960
960
|
|
|
961
961
|
const userAgent = navigator.userAgent;
|
|
962
962
|
const platform$3 = detect$2();
|
|
963
|
-
const browser$
|
|
963
|
+
const browser$2 = platform$3.browser;
|
|
964
964
|
const os$1 = platform$3.os;
|
|
965
965
|
const deviceType = platform$3.deviceType;
|
|
966
966
|
const windowsPhone = userAgent.indexOf('Windows Phone') !== -1;
|
|
967
967
|
const Env = {
|
|
968
968
|
transparentSrc: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
|
|
969
|
-
documentMode: browser$
|
|
969
|
+
documentMode: browser$2.isIE() ? document.documentMode || 7 : 10,
|
|
970
970
|
cacheSuffix: null,
|
|
971
971
|
container: null,
|
|
972
|
-
canHaveCSP: !browser$
|
|
972
|
+
canHaveCSP: !browser$2.isIE(),
|
|
973
973
|
windowsPhone,
|
|
974
974
|
browser: {
|
|
975
|
-
current: browser$
|
|
976
|
-
version: browser$
|
|
977
|
-
isChromium: browser$
|
|
978
|
-
isEdge: browser$
|
|
979
|
-
isFirefox: browser$
|
|
980
|
-
isIE: browser$
|
|
981
|
-
isOpera: browser$
|
|
982
|
-
isSafari: browser$
|
|
975
|
+
current: browser$2.current,
|
|
976
|
+
version: browser$2.version,
|
|
977
|
+
isChromium: browser$2.isChromium,
|
|
978
|
+
isEdge: browser$2.isEdge,
|
|
979
|
+
isFirefox: browser$2.isFirefox,
|
|
980
|
+
isIE: browser$2.isIE,
|
|
981
|
+
isOpera: browser$2.isOpera,
|
|
982
|
+
isSafari: browser$2.isSafari
|
|
983
983
|
},
|
|
984
984
|
os: {
|
|
985
985
|
current: os$1.current,
|
|
@@ -1101,7 +1101,6 @@
|
|
|
1101
1101
|
};
|
|
1102
1102
|
|
|
1103
1103
|
const is$2 = (lhs, rhs, comparator = tripleEquals) => lhs.exists(left => comparator(left, rhs));
|
|
1104
|
-
const equals = (lhs, rhs, comparator = tripleEquals) => lift2(lhs, rhs, comparator).getOr(lhs.isNone() && rhs.isNone());
|
|
1105
1104
|
const cat = arr => {
|
|
1106
1105
|
const r = [];
|
|
1107
1106
|
const push = x => {
|
|
@@ -1745,13 +1744,6 @@
|
|
|
1745
1744
|
const y = doc.body.scrollTop || doc.documentElement.scrollTop;
|
|
1746
1745
|
return SugarPosition(x, y);
|
|
1747
1746
|
};
|
|
1748
|
-
const to = (x, y, _DOC) => {
|
|
1749
|
-
const doc = _DOC !== undefined ? _DOC.dom : document;
|
|
1750
|
-
const win = doc.defaultView;
|
|
1751
|
-
if (win) {
|
|
1752
|
-
win.scrollTo(x, y);
|
|
1753
|
-
}
|
|
1754
|
-
};
|
|
1755
1747
|
const intoView = (element, alignToTop) => {
|
|
1756
1748
|
const isSafari = detect$2().browser.isSafari();
|
|
1757
1749
|
if (isSafari && isFunction(element.dom.scrollIntoViewIfNeeded)) {
|
|
@@ -2532,10 +2524,10 @@
|
|
|
2532
2524
|
const isTransparentInline = (schema, node) => isTransparentElement(schema, node) && !hasBlockAttr(node);
|
|
2533
2525
|
const isTransparentAstBlock = (schema, node) => node.type === 1 && isTransparentElementName(schema, node.name) && isString(node.attr(transparentBlockAttr));
|
|
2534
2526
|
|
|
2535
|
-
const browser$
|
|
2527
|
+
const browser$1 = detect$2().browser;
|
|
2536
2528
|
const firstElement = nodes => find$2(nodes, isElement$7);
|
|
2537
2529
|
const getTableCaptionDeltaY = elm => {
|
|
2538
|
-
if (browser$
|
|
2530
|
+
if (browser$1.isFirefox() && name(elm) === 'table') {
|
|
2539
2531
|
return firstElement(children$1(elm)).filter(elm => {
|
|
2540
2532
|
return name(elm) === 'caption';
|
|
2541
2533
|
}).bind(caption => {
|
|
@@ -2898,75 +2890,23 @@
|
|
|
2898
2890
|
decode
|
|
2899
2891
|
};
|
|
2900
2892
|
|
|
2893
|
+
const lookupCache = {};
|
|
2894
|
+
const mapCache = {};
|
|
2895
|
+
const dummyObj = {};
|
|
2896
|
+
const makeMap$2 = Tools.makeMap, each$b = Tools.each, extend$2 = Tools.extend, explode$2 = Tools.explode, inArray = Tools.inArray;
|
|
2901
2897
|
const split$1 = (items, delim) => {
|
|
2902
2898
|
items = Tools.trim(items);
|
|
2903
2899
|
return items ? items.split(delim || ' ') : [];
|
|
2904
2900
|
};
|
|
2905
|
-
const
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
const customElementRegExp = /^(~)?(.+)$/;
|
|
2909
|
-
return bind$3(split$1(value, ','), rule => {
|
|
2910
|
-
const matches = customElementRegExp.exec(rule);
|
|
2911
|
-
if (matches) {
|
|
2912
|
-
const inline = matches[1] === '~';
|
|
2913
|
-
const cloneName = inline ? 'span' : 'div';
|
|
2914
|
-
const name = matches[2];
|
|
2915
|
-
return [{
|
|
2916
|
-
inline,
|
|
2917
|
-
cloneName,
|
|
2918
|
-
name
|
|
2919
|
-
}];
|
|
2920
|
-
} else {
|
|
2921
|
-
return [];
|
|
2922
|
-
}
|
|
2923
|
-
});
|
|
2901
|
+
const createMap = (defaultValue, extendWith = {}) => {
|
|
2902
|
+
const value = makeMap$2(defaultValue, ' ', makeMap$2(defaultValue.toUpperCase(), ' '));
|
|
2903
|
+
return extend$2(value, extendWith);
|
|
2924
2904
|
};
|
|
2925
|
-
|
|
2926
|
-
const
|
|
2905
|
+
const getTextRootBlockElements = schema => createMap('td th li dt dd figcaption caption details summary', schema.getTextBlockElements());
|
|
2906
|
+
const compileSchema = type => {
|
|
2907
|
+
const schema = {};
|
|
2927
2908
|
let globalAttributes, blockContent;
|
|
2928
2909
|
let phrasingContent, flowContent;
|
|
2929
|
-
globalAttributes = 'id accesskey class dir lang style tabindex title role';
|
|
2930
|
-
blockContent = 'address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul';
|
|
2931
|
-
phrasingContent = 'a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd ' + 'label map noscript object q s samp script select small span strong sub sup ' + 'textarea u var #text #comment';
|
|
2932
|
-
if (type !== 'html4') {
|
|
2933
|
-
const transparentContent = 'a ins del canvas map';
|
|
2934
|
-
globalAttributes += ' contenteditable contextmenu draggable dropzone ' + 'hidden spellcheck translate';
|
|
2935
|
-
blockContent += ' article aside details dialog figure main header footer hgroup section nav ' + transparentContent;
|
|
2936
|
-
phrasingContent += ' audio canvas command datalist mark meter output picture ' + 'progress time wbr video ruby bdi keygen';
|
|
2937
|
-
}
|
|
2938
|
-
if (type !== 'html5-strict') {
|
|
2939
|
-
globalAttributes += ' xml:lang';
|
|
2940
|
-
const html4PhrasingContent = 'acronym applet basefont big font strike tt';
|
|
2941
|
-
phrasingContent = [
|
|
2942
|
-
phrasingContent,
|
|
2943
|
-
html4PhrasingContent
|
|
2944
|
-
].join(' ');
|
|
2945
|
-
const html4BlockContent = 'center dir isindex noframes';
|
|
2946
|
-
blockContent = [
|
|
2947
|
-
blockContent,
|
|
2948
|
-
html4BlockContent
|
|
2949
|
-
].join(' ');
|
|
2950
|
-
flowContent = [
|
|
2951
|
-
blockContent,
|
|
2952
|
-
phrasingContent
|
|
2953
|
-
].join(' ');
|
|
2954
|
-
}
|
|
2955
|
-
flowContent = flowContent || [
|
|
2956
|
-
blockContent,
|
|
2957
|
-
phrasingContent
|
|
2958
|
-
].join(' ');
|
|
2959
|
-
return {
|
|
2960
|
-
globalAttributes,
|
|
2961
|
-
blockContent,
|
|
2962
|
-
phrasingContent,
|
|
2963
|
-
flowContent
|
|
2964
|
-
};
|
|
2965
|
-
};
|
|
2966
|
-
|
|
2967
|
-
const makeSchema = type => {
|
|
2968
|
-
const {globalAttributes, phrasingContent, flowContent} = getElementSetsAsStrings(type);
|
|
2969
|
-
const schema = {};
|
|
2970
2910
|
const add = (name, attributes = '', children = '') => {
|
|
2971
2911
|
const childNames = split$1(children);
|
|
2972
2912
|
const names = split$1(name);
|
|
@@ -2977,9 +2917,9 @@
|
|
|
2977
2917
|
attributes
|
|
2978
2918
|
].join(' '));
|
|
2979
2919
|
schema[names[ni]] = {
|
|
2980
|
-
attributes: mapToObject(attributesOrder,
|
|
2920
|
+
attributes: mapToObject(attributesOrder, () => ({})),
|
|
2981
2921
|
attributesOrder,
|
|
2982
|
-
children: mapToObject(childNames, constant(
|
|
2922
|
+
children: mapToObject(childNames, constant(dummyObj))
|
|
2983
2923
|
};
|
|
2984
2924
|
}
|
|
2985
2925
|
};
|
|
@@ -2995,16 +2935,45 @@
|
|
|
2995
2935
|
}
|
|
2996
2936
|
}
|
|
2997
2937
|
};
|
|
2938
|
+
if (lookupCache[type]) {
|
|
2939
|
+
return lookupCache[type];
|
|
2940
|
+
}
|
|
2941
|
+
globalAttributes = 'id accesskey class dir lang style tabindex title role';
|
|
2942
|
+
blockContent = 'address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul';
|
|
2943
|
+
phrasingContent = 'a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd ' + 'label map noscript object q s samp script select small span strong sub sup ' + 'textarea u var #text #comment';
|
|
2944
|
+
if (type !== 'html4') {
|
|
2945
|
+
const transparentContent = 'a ins del canvas map';
|
|
2946
|
+
globalAttributes += ' contenteditable contextmenu draggable dropzone ' + 'hidden spellcheck translate';
|
|
2947
|
+
blockContent += ' article aside details dialog figure main header footer hgroup section nav ' + transparentContent;
|
|
2948
|
+
phrasingContent += ' audio canvas command datalist mark meter output picture ' + 'progress time wbr video ruby bdi keygen';
|
|
2949
|
+
}
|
|
2998
2950
|
if (type !== 'html5-strict') {
|
|
2951
|
+
globalAttributes += ' xml:lang';
|
|
2999
2952
|
const html4PhrasingContent = 'acronym applet basefont big font strike tt';
|
|
3000
|
-
|
|
2953
|
+
phrasingContent = [
|
|
2954
|
+
phrasingContent,
|
|
2955
|
+
html4PhrasingContent
|
|
2956
|
+
].join(' ');
|
|
2957
|
+
each$b(split$1(html4PhrasingContent), name => {
|
|
3001
2958
|
add(name, '', phrasingContent);
|
|
3002
2959
|
});
|
|
3003
2960
|
const html4BlockContent = 'center dir isindex noframes';
|
|
3004
|
-
|
|
2961
|
+
blockContent = [
|
|
2962
|
+
blockContent,
|
|
2963
|
+
html4BlockContent
|
|
2964
|
+
].join(' ');
|
|
2965
|
+
flowContent = [
|
|
2966
|
+
blockContent,
|
|
2967
|
+
phrasingContent
|
|
2968
|
+
].join(' ');
|
|
2969
|
+
each$b(split$1(html4BlockContent), name => {
|
|
3005
2970
|
add(name, '', flowContent);
|
|
3006
2971
|
});
|
|
3007
2972
|
}
|
|
2973
|
+
flowContent = flowContent || [
|
|
2974
|
+
blockContent,
|
|
2975
|
+
phrasingContent
|
|
2976
|
+
].join(' ');
|
|
3008
2977
|
add('html', 'manifest', 'head body');
|
|
3009
2978
|
add('head', '', 'base command link meta noscript script style title');
|
|
3010
2979
|
add('title hr noscript br');
|
|
@@ -3156,155 +3125,16 @@
|
|
|
3156
3125
|
delete item.children.video;
|
|
3157
3126
|
});
|
|
3158
3127
|
}
|
|
3159
|
-
each$
|
|
3128
|
+
each$b(split$1('a form meter progress dfn'), name => {
|
|
3160
3129
|
if (schema[name]) {
|
|
3161
3130
|
delete schema[name].children[name];
|
|
3162
3131
|
}
|
|
3163
3132
|
});
|
|
3164
3133
|
delete schema.caption.children.table;
|
|
3165
3134
|
delete schema.script;
|
|
3135
|
+
lookupCache[type] = schema;
|
|
3166
3136
|
return schema;
|
|
3167
3137
|
};
|
|
3168
|
-
|
|
3169
|
-
const prefixToOperation = prefix => prefix === '-' ? 'remove' : 'add';
|
|
3170
|
-
const parseValidChildrenRules = value => {
|
|
3171
|
-
const childRuleRegExp = /^([+\-]?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)\[([^\]]+)]$/;
|
|
3172
|
-
return bind$3(split$1(value, ','), rule => {
|
|
3173
|
-
const matches = childRuleRegExp.exec(rule);
|
|
3174
|
-
if (matches) {
|
|
3175
|
-
const prefix = matches[1];
|
|
3176
|
-
const operation = prefix ? prefixToOperation(prefix) : 'replace';
|
|
3177
|
-
const name = matches[2];
|
|
3178
|
-
const validChildren = split$1(matches[3], '|');
|
|
3179
|
-
return [{
|
|
3180
|
-
operation,
|
|
3181
|
-
name,
|
|
3182
|
-
validChildren
|
|
3183
|
-
}];
|
|
3184
|
-
} else {
|
|
3185
|
-
return [];
|
|
3186
|
-
}
|
|
3187
|
-
});
|
|
3188
|
-
};
|
|
3189
|
-
|
|
3190
|
-
const parseValidElementsAttrDataIntoElement = (attrData, targetElement) => {
|
|
3191
|
-
const attrRuleRegExp = /^([!\-])?(\w+[\\:]:\w+|[^=~<]+)?(?:([=~<])(.*))?$/;
|
|
3192
|
-
const hasPatternsRegExp = /[*?+]/;
|
|
3193
|
-
const {attributes, attributesOrder} = targetElement;
|
|
3194
|
-
return each$e(split$1(attrData, '|'), rule => {
|
|
3195
|
-
const matches = attrRuleRegExp.exec(rule);
|
|
3196
|
-
if (matches) {
|
|
3197
|
-
const attr = {};
|
|
3198
|
-
const attrType = matches[1];
|
|
3199
|
-
const attrName = matches[2].replace(/[\\:]:/g, ':');
|
|
3200
|
-
const attrPrefix = matches[3];
|
|
3201
|
-
const value = matches[4];
|
|
3202
|
-
if (attrType === '!') {
|
|
3203
|
-
targetElement.attributesRequired = targetElement.attributesRequired || [];
|
|
3204
|
-
targetElement.attributesRequired.push(attrName);
|
|
3205
|
-
attr.required = true;
|
|
3206
|
-
}
|
|
3207
|
-
if (attrType === '-') {
|
|
3208
|
-
delete attributes[attrName];
|
|
3209
|
-
attributesOrder.splice(Tools.inArray(attributesOrder, attrName), 1);
|
|
3210
|
-
return;
|
|
3211
|
-
}
|
|
3212
|
-
if (attrPrefix) {
|
|
3213
|
-
if (attrPrefix === '=') {
|
|
3214
|
-
targetElement.attributesDefault = targetElement.attributesDefault || [];
|
|
3215
|
-
targetElement.attributesDefault.push({
|
|
3216
|
-
name: attrName,
|
|
3217
|
-
value
|
|
3218
|
-
});
|
|
3219
|
-
attr.defaultValue = value;
|
|
3220
|
-
} else if (attrPrefix === '~') {
|
|
3221
|
-
targetElement.attributesForced = targetElement.attributesForced || [];
|
|
3222
|
-
targetElement.attributesForced.push({
|
|
3223
|
-
name: attrName,
|
|
3224
|
-
value
|
|
3225
|
-
});
|
|
3226
|
-
attr.forcedValue = value;
|
|
3227
|
-
} else if (attrPrefix === '<') {
|
|
3228
|
-
attr.validValues = Tools.makeMap(value, '?');
|
|
3229
|
-
}
|
|
3230
|
-
}
|
|
3231
|
-
if (hasPatternsRegExp.test(attrName)) {
|
|
3232
|
-
const attrPattern = attr;
|
|
3233
|
-
targetElement.attributePatterns = targetElement.attributePatterns || [];
|
|
3234
|
-
attrPattern.pattern = patternToRegExp(attrName);
|
|
3235
|
-
targetElement.attributePatterns.push(attrPattern);
|
|
3236
|
-
} else {
|
|
3237
|
-
if (!attributes[attrName]) {
|
|
3238
|
-
attributesOrder.push(attrName);
|
|
3239
|
-
}
|
|
3240
|
-
attributes[attrName] = attr;
|
|
3241
|
-
}
|
|
3242
|
-
}
|
|
3243
|
-
});
|
|
3244
|
-
};
|
|
3245
|
-
const cloneAttributesInto = (from, to) => {
|
|
3246
|
-
each$d(from.attributes, (value, key) => {
|
|
3247
|
-
to.attributes[key] = value;
|
|
3248
|
-
});
|
|
3249
|
-
to.attributesOrder.push(...from.attributesOrder);
|
|
3250
|
-
};
|
|
3251
|
-
const parseValidElementsRules = (globalElement, validElements) => {
|
|
3252
|
-
const elementRuleRegExp = /^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)])?$/;
|
|
3253
|
-
return bind$3(split$1(validElements, ','), rule => {
|
|
3254
|
-
const matches = elementRuleRegExp.exec(rule);
|
|
3255
|
-
if (matches) {
|
|
3256
|
-
const prefix = matches[1];
|
|
3257
|
-
const elementName = matches[2];
|
|
3258
|
-
const outputName = matches[3];
|
|
3259
|
-
const attrsPrefix = matches[4];
|
|
3260
|
-
const attrData = matches[5];
|
|
3261
|
-
const element = {
|
|
3262
|
-
attributes: {},
|
|
3263
|
-
attributesOrder: []
|
|
3264
|
-
};
|
|
3265
|
-
globalElement.each(el => cloneAttributesInto(el, element));
|
|
3266
|
-
if (prefix === '#') {
|
|
3267
|
-
element.paddEmpty = true;
|
|
3268
|
-
} else if (prefix === '-') {
|
|
3269
|
-
element.removeEmpty = true;
|
|
3270
|
-
}
|
|
3271
|
-
if (attrsPrefix === '!') {
|
|
3272
|
-
element.removeEmptyAttrs = true;
|
|
3273
|
-
}
|
|
3274
|
-
if (attrData) {
|
|
3275
|
-
parseValidElementsAttrDataIntoElement(attrData, element);
|
|
3276
|
-
}
|
|
3277
|
-
if (outputName) {
|
|
3278
|
-
element.outputName = elementName;
|
|
3279
|
-
}
|
|
3280
|
-
if (elementName === '@') {
|
|
3281
|
-
if (globalElement.isNone()) {
|
|
3282
|
-
globalElement = Optional.some(element);
|
|
3283
|
-
} else {
|
|
3284
|
-
return [];
|
|
3285
|
-
}
|
|
3286
|
-
}
|
|
3287
|
-
return [outputName ? {
|
|
3288
|
-
name: elementName,
|
|
3289
|
-
element,
|
|
3290
|
-
aliasName: outputName
|
|
3291
|
-
} : {
|
|
3292
|
-
name: elementName,
|
|
3293
|
-
element
|
|
3294
|
-
}];
|
|
3295
|
-
} else {
|
|
3296
|
-
return [];
|
|
3297
|
-
}
|
|
3298
|
-
});
|
|
3299
|
-
};
|
|
3300
|
-
|
|
3301
|
-
const mapCache = {};
|
|
3302
|
-
const makeMap$2 = Tools.makeMap, each$b = Tools.each, extend$2 = Tools.extend, explode$2 = Tools.explode;
|
|
3303
|
-
const createMap = (defaultValue, extendWith = {}) => {
|
|
3304
|
-
const value = makeMap$2(defaultValue, ' ', makeMap$2(defaultValue.toUpperCase(), ' '));
|
|
3305
|
-
return extend$2(value, extendWith);
|
|
3306
|
-
};
|
|
3307
|
-
const getTextRootBlockElements = schema => createMap('td th li dt dd figcaption caption details summary', schema.getTextBlockElements());
|
|
3308
3138
|
const compileElementMap = (value, mode) => {
|
|
3309
3139
|
if (value) {
|
|
3310
3140
|
const styles = {};
|
|
@@ -3340,7 +3170,7 @@
|
|
|
3340
3170
|
}
|
|
3341
3171
|
};
|
|
3342
3172
|
const schemaType = (_a = settings.schema) !== null && _a !== void 0 ? _a : 'html5';
|
|
3343
|
-
const schemaItems =
|
|
3173
|
+
const schemaItems = compileSchema(schemaType);
|
|
3344
3174
|
if (settings.verify_html === false) {
|
|
3345
3175
|
settings.valid_elements = '*[*]';
|
|
3346
3176
|
}
|
|
@@ -3361,21 +3191,122 @@
|
|
|
3361
3191
|
each$b('script noscript iframe noframes noembed title style textarea xmp plaintext'.split(' '), name => {
|
|
3362
3192
|
specialElements[name] = new RegExp('</' + name + '[^>]*>', 'gi');
|
|
3363
3193
|
});
|
|
3194
|
+
const patternToRegExp = str => new RegExp('^' + str.replace(/([?+*])/g, '.$1') + '$');
|
|
3364
3195
|
const addValidElements = validElements => {
|
|
3365
|
-
const
|
|
3196
|
+
const elementRuleRegExp = /^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)])?$/;
|
|
3197
|
+
const attrRuleRegExp = /^([!\-])?(\w+[\\:]:\w+|[^=~<]+)?(?:([=~<])(.*))?$/;
|
|
3366
3198
|
const hasPatternsRegExp = /[*?+]/;
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
if (
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3199
|
+
if (validElements) {
|
|
3200
|
+
const validElementsArr = split$1(validElements, ',');
|
|
3201
|
+
let globalAttributes;
|
|
3202
|
+
let globalAttributesOrder;
|
|
3203
|
+
if (elements['@']) {
|
|
3204
|
+
globalAttributes = elements['@'].attributes;
|
|
3205
|
+
globalAttributesOrder = elements['@'].attributesOrder;
|
|
3206
|
+
}
|
|
3207
|
+
for (let ei = 0, el = validElementsArr.length; ei < el; ei++) {
|
|
3208
|
+
let matches = elementRuleRegExp.exec(validElementsArr[ei]);
|
|
3209
|
+
if (matches) {
|
|
3210
|
+
const prefix = matches[1];
|
|
3211
|
+
const elementName = matches[2];
|
|
3212
|
+
const outputName = matches[3];
|
|
3213
|
+
const attrData = matches[5];
|
|
3214
|
+
const attributes = {};
|
|
3215
|
+
const attributesOrder = [];
|
|
3216
|
+
const element = {
|
|
3217
|
+
attributes,
|
|
3218
|
+
attributesOrder
|
|
3219
|
+
};
|
|
3220
|
+
if (prefix === '#') {
|
|
3221
|
+
element.paddEmpty = true;
|
|
3222
|
+
}
|
|
3223
|
+
if (prefix === '-') {
|
|
3224
|
+
element.removeEmpty = true;
|
|
3225
|
+
}
|
|
3226
|
+
if (matches[4] === '!') {
|
|
3227
|
+
element.removeEmptyAttrs = true;
|
|
3228
|
+
}
|
|
3229
|
+
if (globalAttributes) {
|
|
3230
|
+
each$d(globalAttributes, (value, key) => {
|
|
3231
|
+
attributes[key] = value;
|
|
3232
|
+
});
|
|
3233
|
+
if (globalAttributesOrder) {
|
|
3234
|
+
attributesOrder.push(...globalAttributesOrder);
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
if (attrData) {
|
|
3238
|
+
const attrDatas = split$1(attrData, '|');
|
|
3239
|
+
for (let ai = 0, al = attrDatas.length; ai < al; ai++) {
|
|
3240
|
+
matches = attrRuleRegExp.exec(attrDatas[ai]);
|
|
3241
|
+
if (matches) {
|
|
3242
|
+
const attr = {};
|
|
3243
|
+
const attrType = matches[1];
|
|
3244
|
+
const attrName = matches[2].replace(/[\\:]:/g, ':');
|
|
3245
|
+
const attrPrefix = matches[3];
|
|
3246
|
+
const value = matches[4];
|
|
3247
|
+
if (attrType === '!') {
|
|
3248
|
+
element.attributesRequired = element.attributesRequired || [];
|
|
3249
|
+
element.attributesRequired.push(attrName);
|
|
3250
|
+
attr.required = true;
|
|
3251
|
+
}
|
|
3252
|
+
if (attrType === '-') {
|
|
3253
|
+
delete attributes[attrName];
|
|
3254
|
+
attributesOrder.splice(inArray(attributesOrder, attrName), 1);
|
|
3255
|
+
continue;
|
|
3256
|
+
}
|
|
3257
|
+
if (attrPrefix) {
|
|
3258
|
+
if (attrPrefix === '=') {
|
|
3259
|
+
element.attributesDefault = element.attributesDefault || [];
|
|
3260
|
+
element.attributesDefault.push({
|
|
3261
|
+
name: attrName,
|
|
3262
|
+
value
|
|
3263
|
+
});
|
|
3264
|
+
attr.defaultValue = value;
|
|
3265
|
+
}
|
|
3266
|
+
if (attrPrefix === '~') {
|
|
3267
|
+
element.attributesForced = element.attributesForced || [];
|
|
3268
|
+
element.attributesForced.push({
|
|
3269
|
+
name: attrName,
|
|
3270
|
+
value
|
|
3271
|
+
});
|
|
3272
|
+
attr.forcedValue = value;
|
|
3273
|
+
}
|
|
3274
|
+
if (attrPrefix === '<') {
|
|
3275
|
+
attr.validValues = makeMap$2(value, '?');
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
if (hasPatternsRegExp.test(attrName)) {
|
|
3279
|
+
const attrPattern = attr;
|
|
3280
|
+
element.attributePatterns = element.attributePatterns || [];
|
|
3281
|
+
attrPattern.pattern = patternToRegExp(attrName);
|
|
3282
|
+
element.attributePatterns.push(attrPattern);
|
|
3283
|
+
} else {
|
|
3284
|
+
if (!attributes[attrName]) {
|
|
3285
|
+
attributesOrder.push(attrName);
|
|
3286
|
+
}
|
|
3287
|
+
attributes[attrName] = attr;
|
|
3288
|
+
}
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
if (!globalAttributes && elementName === '@') {
|
|
3293
|
+
globalAttributes = attributes;
|
|
3294
|
+
globalAttributesOrder = attributesOrder;
|
|
3295
|
+
}
|
|
3296
|
+
if (outputName) {
|
|
3297
|
+
element.outputName = elementName;
|
|
3298
|
+
elements[outputName] = element;
|
|
3299
|
+
}
|
|
3300
|
+
if (hasPatternsRegExp.test(elementName)) {
|
|
3301
|
+
const patternElement = element;
|
|
3302
|
+
patternElement.pattern = patternToRegExp(elementName);
|
|
3303
|
+
patternElements.push(patternElement);
|
|
3304
|
+
} else {
|
|
3305
|
+
elements[elementName] = element;
|
|
3306
|
+
}
|
|
3307
|
+
}
|
|
3377
3308
|
}
|
|
3378
|
-
}
|
|
3309
|
+
}
|
|
3379
3310
|
};
|
|
3380
3311
|
const setValidElements = validElements => {
|
|
3381
3312
|
patternElements = [];
|
|
@@ -3383,46 +3314,71 @@
|
|
|
3383
3314
|
delete elements[name];
|
|
3384
3315
|
});
|
|
3385
3316
|
addValidElements(validElements);
|
|
3317
|
+
each$b(schemaItems, (element, name) => {
|
|
3318
|
+
children[name] = element.children;
|
|
3319
|
+
});
|
|
3386
3320
|
};
|
|
3387
3321
|
const addCustomElements = customElements => {
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3322
|
+
const customElementRegExp = /^(~)?(.+)$/;
|
|
3323
|
+
if (customElements) {
|
|
3324
|
+
delete mapCache.text_block_elements;
|
|
3325
|
+
delete mapCache.block_elements;
|
|
3326
|
+
each$b(split$1(customElements, ','), rule => {
|
|
3327
|
+
const matches = customElementRegExp.exec(rule);
|
|
3328
|
+
if (matches) {
|
|
3329
|
+
const inline = matches[1] === '~';
|
|
3330
|
+
const cloneName = inline ? 'span' : 'div';
|
|
3331
|
+
const name = matches[2];
|
|
3332
|
+
children[name] = children[cloneName];
|
|
3333
|
+
customElementsMap[name] = cloneName;
|
|
3334
|
+
nonEmptyElementsMap[name.toUpperCase()] = {};
|
|
3335
|
+
nonEmptyElementsMap[name] = {};
|
|
3336
|
+
if (!inline) {
|
|
3337
|
+
blockElementsMap[name.toUpperCase()] = {};
|
|
3338
|
+
blockElementsMap[name] = {};
|
|
3339
|
+
}
|
|
3340
|
+
if (!elements[name]) {
|
|
3341
|
+
let customRule = elements[cloneName];
|
|
3342
|
+
customRule = extend$2({}, customRule);
|
|
3343
|
+
delete customRule.removeEmptyAttrs;
|
|
3344
|
+
delete customRule.removeEmpty;
|
|
3345
|
+
elements[name] = customRule;
|
|
3346
|
+
}
|
|
3347
|
+
each$b(children, (element, elmName) => {
|
|
3348
|
+
if (element[cloneName]) {
|
|
3349
|
+
children[elmName] = element = extend$2({}, children[elmName]);
|
|
3350
|
+
element[name] = element[cloneName];
|
|
3351
|
+
}
|
|
3352
|
+
});
|
|
3410
3353
|
}
|
|
3411
3354
|
});
|
|
3412
|
-
}
|
|
3355
|
+
}
|
|
3413
3356
|
};
|
|
3414
3357
|
const addValidChildren = validChildren => {
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3358
|
+
const childRuleRegExp = /^([+\-]?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)\[([^\]]+)]$/;
|
|
3359
|
+
delete lookupCache[schemaType];
|
|
3360
|
+
if (validChildren) {
|
|
3361
|
+
each$b(split$1(validChildren, ','), rule => {
|
|
3362
|
+
const matches = childRuleRegExp.exec(rule);
|
|
3363
|
+
if (matches) {
|
|
3364
|
+
const prefix = matches[1];
|
|
3365
|
+
let parent;
|
|
3366
|
+
if (prefix) {
|
|
3367
|
+
parent = children[matches[2]];
|
|
3368
|
+
} else {
|
|
3369
|
+
parent = children[matches[2]] = { '#comment': {} };
|
|
3370
|
+
}
|
|
3371
|
+
parent = children[matches[2]];
|
|
3372
|
+
each$b(split$1(matches[3], '|'), child => {
|
|
3373
|
+
if (prefix === '-') {
|
|
3374
|
+
delete parent[child];
|
|
3375
|
+
} else {
|
|
3376
|
+
parent[child] = {};
|
|
3377
|
+
}
|
|
3378
|
+
});
|
|
3422
3379
|
}
|
|
3423
3380
|
});
|
|
3424
|
-
|
|
3425
|
-
});
|
|
3381
|
+
}
|
|
3426
3382
|
};
|
|
3427
3383
|
const getElementRule = name => {
|
|
3428
3384
|
const element = elements[name];
|
|
@@ -3473,9 +3429,6 @@
|
|
|
3473
3429
|
});
|
|
3474
3430
|
} else {
|
|
3475
3431
|
setValidElements(settings.valid_elements);
|
|
3476
|
-
each$b(schemaItems, (element, name) => {
|
|
3477
|
-
children[name] = element.children;
|
|
3478
|
-
});
|
|
3479
3432
|
}
|
|
3480
3433
|
addCustomElements(settings.custom_elements);
|
|
3481
3434
|
addValidChildren(settings.valid_children);
|
|
@@ -3645,7 +3598,7 @@
|
|
|
3645
3598
|
if (!value) {
|
|
3646
3599
|
return;
|
|
3647
3600
|
}
|
|
3648
|
-
const values = value.
|
|
3601
|
+
const values = value.split(' ');
|
|
3649
3602
|
let i = values.length;
|
|
3650
3603
|
while (i--) {
|
|
3651
3604
|
if (values[i] !== values[0]) {
|
|
@@ -5070,10 +5023,6 @@
|
|
|
5070
5023
|
};
|
|
5071
5024
|
};
|
|
5072
5025
|
|
|
5073
|
-
const isDuplicated = (items, item) => {
|
|
5074
|
-
const firstIndex = items.indexOf(item);
|
|
5075
|
-
return firstIndex !== -1 && items.indexOf(item, firstIndex + 1) > firstIndex;
|
|
5076
|
-
};
|
|
5077
5026
|
const isRaw = str => isObject(str) && has$2(str, 'raw');
|
|
5078
5027
|
const isTokenised = str => isArray$1(str) && str.length > 1;
|
|
5079
5028
|
const data = {};
|
|
@@ -5091,17 +5040,8 @@
|
|
|
5091
5040
|
if (!langData) {
|
|
5092
5041
|
data[code] = langData = {};
|
|
5093
5042
|
}
|
|
5094
|
-
const lcNames = map$3(keys(items), name => name.toLowerCase());
|
|
5095
5043
|
each$d(items, (translation, name) => {
|
|
5096
|
-
|
|
5097
|
-
if (lcName !== name && isDuplicated(lcNames, lcName)) {
|
|
5098
|
-
if (!has$2(items, lcName)) {
|
|
5099
|
-
langData[lcName] = translation;
|
|
5100
|
-
}
|
|
5101
|
-
langData[name] = translation;
|
|
5102
|
-
} else {
|
|
5103
|
-
langData[lcName] = translation;
|
|
5104
|
-
}
|
|
5044
|
+
langData[name.toLowerCase()] = translation;
|
|
5105
5045
|
});
|
|
5106
5046
|
};
|
|
5107
5047
|
const translate = text => {
|
|
@@ -5114,8 +5054,8 @@
|
|
|
5114
5054
|
};
|
|
5115
5055
|
const isEmpty = text => text === '' || text === null || text === undefined;
|
|
5116
5056
|
const getLangData = text => {
|
|
5117
|
-
const
|
|
5118
|
-
return
|
|
5057
|
+
const textstr = toString(text);
|
|
5058
|
+
return get$a(langData, textstr.toLowerCase()).map(toString).getOr(textstr);
|
|
5119
5059
|
};
|
|
5120
5060
|
const removeContext = str => str.replace(/{context:\w+}$/, '');
|
|
5121
5061
|
if (isEmpty(text)) {
|
|
@@ -10338,7 +10278,7 @@
|
|
|
10338
10278
|
return;
|
|
10339
10279
|
}
|
|
10340
10280
|
const scrollTop = get$5(doc).top;
|
|
10341
|
-
f(
|
|
10281
|
+
f(doc, scrollTop, marker, alignToTop);
|
|
10342
10282
|
fireAfterScrollIntoViewEvent(editor, data);
|
|
10343
10283
|
};
|
|
10344
10284
|
const applyWithMarker = (editor, f, rng, alignToTop) => {
|
|
@@ -10364,36 +10304,28 @@
|
|
|
10364
10304
|
newRng.setEnd(endElement, endOffset);
|
|
10365
10305
|
editor.selection.setRng(rng);
|
|
10366
10306
|
};
|
|
10367
|
-
const scrollToMarker = (
|
|
10368
|
-
|
|
10369
|
-
if (alignToTop) {
|
|
10370
|
-
to(pos.left, pos.top, doc);
|
|
10371
|
-
} else {
|
|
10372
|
-
const y = pos.top - viewHeight + marker.height;
|
|
10373
|
-
to(-editor.getBody().getBoundingClientRect().left, y, doc);
|
|
10374
|
-
}
|
|
10375
|
-
};
|
|
10376
|
-
const intoWindowIfNeeded = (editor, doc, scrollTop, viewHeight, marker, alignToTop) => {
|
|
10307
|
+
const scrollToMarker = (marker, alignToTop) => marker.element.dom.scrollIntoView({ block: alignToTop ? 'start' : 'end' });
|
|
10308
|
+
const intoWindowIfNeeded = (scrollTop, viewHeight, marker, alignToTop) => {
|
|
10377
10309
|
const viewportBottom = viewHeight + scrollTop;
|
|
10378
10310
|
const markerTop = marker.pos.top;
|
|
10379
10311
|
const markerBottom = marker.bottom;
|
|
10380
10312
|
const largerThanViewport = markerBottom - markerTop >= viewHeight;
|
|
10381
10313
|
if (markerTop < scrollTop) {
|
|
10382
|
-
scrollToMarker(
|
|
10314
|
+
scrollToMarker(marker, alignToTop !== false);
|
|
10383
10315
|
} else if (markerTop > viewportBottom) {
|
|
10384
10316
|
const align = largerThanViewport ? alignToTop !== false : alignToTop === true;
|
|
10385
|
-
scrollToMarker(
|
|
10317
|
+
scrollToMarker(marker, align);
|
|
10386
10318
|
} else if (markerBottom > viewportBottom && !largerThanViewport) {
|
|
10387
|
-
scrollToMarker(
|
|
10319
|
+
scrollToMarker(marker, alignToTop === true);
|
|
10388
10320
|
}
|
|
10389
10321
|
};
|
|
10390
|
-
const intoWindow = (
|
|
10322
|
+
const intoWindow = (doc, scrollTop, marker, alignToTop) => {
|
|
10391
10323
|
const viewHeight = defaultView(doc).dom.innerHeight;
|
|
10392
|
-
intoWindowIfNeeded(
|
|
10324
|
+
intoWindowIfNeeded(scrollTop, viewHeight, marker, alignToTop);
|
|
10393
10325
|
};
|
|
10394
|
-
const intoFrame = (
|
|
10326
|
+
const intoFrame = (doc, scrollTop, marker, alignToTop) => {
|
|
10395
10327
|
const frameViewHeight = defaultView(doc).dom.innerHeight;
|
|
10396
|
-
intoWindowIfNeeded(
|
|
10328
|
+
intoWindowIfNeeded(scrollTop, frameViewHeight, marker, alignToTop);
|
|
10397
10329
|
const op = find(marker.element);
|
|
10398
10330
|
const viewportBounds = getBounds(window);
|
|
10399
10331
|
if (op.top < viewportBounds.y) {
|
|
@@ -12251,7 +12183,7 @@
|
|
|
12251
12183
|
const rootElm = SugarElement.fromDom(editor.getBody());
|
|
12252
12184
|
return getParentCaption(rootElm, startElm).fold(() => deleteCaretCells(editor, forward, rootElm, startElm).orThunk(() => someIf(isBeforeOrAfterTable(editor, forward), noop)), fromCaption => deleteCaretCaption(editor, forward, rootElm, fromCaption));
|
|
12253
12185
|
};
|
|
12254
|
-
const backspaceDelete$
|
|
12186
|
+
const backspaceDelete$9 = (editor, forward) => {
|
|
12255
12187
|
const startElm = SugarElement.fromDom(editor.selection.getStart(true));
|
|
12256
12188
|
const cells = getCellsFromEditor(editor);
|
|
12257
12189
|
return editor.selection.isCollapsed() && cells.length === 0 ? deleteCaret$3(editor, forward, startElm) : deleteRange$3(editor, startElm, cells);
|
|
@@ -12464,7 +12396,7 @@
|
|
|
12464
12396
|
const textBlockElements = schema.getTextBlockElements();
|
|
12465
12397
|
const nonEmptyElements = schema.getNonEmptyElements();
|
|
12466
12398
|
const whitespaceElements = schema.getWhitespaceElements();
|
|
12467
|
-
const nonSplittableElements = Tools.makeMap('tr,td,th,tbody,thead,tfoot,table
|
|
12399
|
+
const nonSplittableElements = Tools.makeMap('tr,td,th,tbody,thead,tfoot,table');
|
|
12468
12400
|
const fixed = new Set();
|
|
12469
12401
|
const isSplittableElement = node => node !== rootNode && !nonSplittableElements[node.name];
|
|
12470
12402
|
for (let ni = 0; ni < nodes.length; ni++) {
|
|
@@ -12703,7 +12635,7 @@
|
|
|
12703
12635
|
}
|
|
12704
12636
|
return findLastOf(elms[elms.length - 1], rootNode);
|
|
12705
12637
|
};
|
|
12706
|
-
const insertBefore$
|
|
12638
|
+
const insertBefore$1 = (target, elms, rootNode) => {
|
|
12707
12639
|
const parentElm = target.parentNode;
|
|
12708
12640
|
if (parentElm) {
|
|
12709
12641
|
Tools.each(elms, elm => {
|
|
@@ -12712,7 +12644,7 @@
|
|
|
12712
12644
|
}
|
|
12713
12645
|
return findFirstIn(target, rootNode);
|
|
12714
12646
|
};
|
|
12715
|
-
const insertAfter$
|
|
12647
|
+
const insertAfter$1 = (target, elms, rootNode, dom) => {
|
|
12716
12648
|
dom.insertAfter(elms.reverse(), target);
|
|
12717
12649
|
return findLastOf(elms[0], rootNode);
|
|
12718
12650
|
};
|
|
@@ -12732,9 +12664,9 @@
|
|
|
12732
12664
|
if (!liTarget) {
|
|
12733
12665
|
return null;
|
|
12734
12666
|
} else if (isAt(BEGINNING)) {
|
|
12735
|
-
return insertBefore$
|
|
12667
|
+
return insertBefore$1(liTarget, liElms, rootNode);
|
|
12736
12668
|
} else if (isAt(END)) {
|
|
12737
|
-
return insertAfter$
|
|
12669
|
+
return insertAfter$1(liTarget, liElms, rootNode, dom);
|
|
12738
12670
|
} else {
|
|
12739
12671
|
return insertMiddle(liTarget, liElms, rootNode, rng);
|
|
12740
12672
|
}
|
|
@@ -12862,15 +12794,14 @@
|
|
|
12862
12794
|
const parentBlock = dom.getParent(marker, dom.isBlock);
|
|
12863
12795
|
dom.remove(marker);
|
|
12864
12796
|
if (parentBlock && dom.isEmpty(parentBlock)) {
|
|
12865
|
-
const isCell = isTableCell(parentBlock);
|
|
12866
12797
|
empty(SugarElement.fromDom(parentBlock));
|
|
12867
12798
|
rng.setStart(parentBlock, 0);
|
|
12868
12799
|
rng.setEnd(parentBlock, 0);
|
|
12869
|
-
if (!
|
|
12800
|
+
if (!isTableCell(parentBlock) && !isPartOfFragment(parentBlock) && (nextRng = findNextCaretRng(rng))) {
|
|
12870
12801
|
rng = nextRng;
|
|
12871
12802
|
dom.remove(parentBlock);
|
|
12872
12803
|
} else {
|
|
12873
|
-
dom.add(parentBlock, dom.create('br',
|
|
12804
|
+
dom.add(parentBlock, dom.create('br', { 'data-mce-bogus': '1' }));
|
|
12874
12805
|
}
|
|
12875
12806
|
}
|
|
12876
12807
|
selection.setRng(rng);
|
|
@@ -12896,6 +12827,18 @@
|
|
|
12896
12827
|
}
|
|
12897
12828
|
return Optional.none();
|
|
12898
12829
|
};
|
|
12830
|
+
const preventSplittingSummary = editor => {
|
|
12831
|
+
each$e(from(editor.getBody().querySelectorAll('details')), accordion => {
|
|
12832
|
+
const summaries = filter$5(from(accordion.children), node => node.nodeName === 'SUMMARY');
|
|
12833
|
+
if (summaries.length > 1) {
|
|
12834
|
+
each$e(summaries.slice(1), summary => {
|
|
12835
|
+
const element = SugarElement.fromDom(summary);
|
|
12836
|
+
remove$7(element, 'mce-accordion-summary');
|
|
12837
|
+
mutate(element, 'p');
|
|
12838
|
+
});
|
|
12839
|
+
}
|
|
12840
|
+
});
|
|
12841
|
+
};
|
|
12899
12842
|
const insertHtmlAtCaret = (editor, value, details) => {
|
|
12900
12843
|
var _a, _b;
|
|
12901
12844
|
const selection = editor.selection;
|
|
@@ -12992,6 +12935,7 @@
|
|
|
12992
12935
|
moveSelectionToMarker(editor, dom.get('mce_marker'));
|
|
12993
12936
|
unmarkFragmentElements(editor.getBody());
|
|
12994
12937
|
trimBrsFromTableCell(dom, selection.getStart());
|
|
12938
|
+
preventSplittingSummary(editor);
|
|
12995
12939
|
updateCaret(editor.schema, editor.getBody(), selection.getStart());
|
|
12996
12940
|
return value;
|
|
12997
12941
|
};
|
|
@@ -21014,7 +20958,7 @@
|
|
|
21014
20958
|
};
|
|
21015
20959
|
const mergeBlocks = (rootNode, forward, block1, block2) => forward ? mergeBlockInto(rootNode, block2, block1) : mergeBlockInto(rootNode, block1, block2);
|
|
21016
20960
|
|
|
21017
|
-
const backspaceDelete$
|
|
20961
|
+
const backspaceDelete$8 = (editor, forward) => {
|
|
21018
20962
|
const rootNode = SugarElement.fromDom(editor.getBody());
|
|
21019
20963
|
const position = read$1(rootNode.dom, forward, editor.selection.getRng()).map(blockBoundary => () => {
|
|
21020
20964
|
mergeBlocks(rootNode, forward, blockBoundary.from.block, blockBoundary.to.block).each(pos => {
|
|
@@ -21061,7 +21005,7 @@
|
|
|
21061
21005
|
const rng = editor.selection.getRng();
|
|
21062
21006
|
return isEverythingSelected(rootNode, rng) ? emptyEditor(editor) : deleteRangeMergeBlocks(rootNode, editor.selection);
|
|
21063
21007
|
};
|
|
21064
|
-
const backspaceDelete$
|
|
21008
|
+
const backspaceDelete$7 = (editor, _forward) => editor.selection.isCollapsed() ? Optional.none() : deleteRange$2(editor);
|
|
21065
21009
|
|
|
21066
21010
|
const showCaret = (direction, editor, node, before, scrollIntoView) => Optional.from(editor._selectionOverrides.showCaret(direction, node, before, scrollIntoView));
|
|
21067
21011
|
const getNodeRange = node => {
|
|
@@ -21144,7 +21088,7 @@
|
|
|
21144
21088
|
}
|
|
21145
21089
|
return Optional.none();
|
|
21146
21090
|
};
|
|
21147
|
-
const backspaceDelete$
|
|
21091
|
+
const backspaceDelete$6 = (editor, forward) => deleteBoundaryText(editor, forward);
|
|
21148
21092
|
|
|
21149
21093
|
const getEdgeCefPosition = (editor, atStart) => {
|
|
21150
21094
|
const root = editor.getBody();
|
|
@@ -21283,7 +21227,7 @@
|
|
|
21283
21227
|
}
|
|
21284
21228
|
return true;
|
|
21285
21229
|
};
|
|
21286
|
-
const backspaceDelete$
|
|
21230
|
+
const backspaceDelete$5 = (editor, forward) => {
|
|
21287
21231
|
if (editor.selection.isCollapsed()) {
|
|
21288
21232
|
return backspaceDeleteCaret(editor, forward);
|
|
21289
21233
|
} else {
|
|
@@ -21295,7 +21239,7 @@
|
|
|
21295
21239
|
const fromPos = CaretPosition.fromRangeStart(editor.selection.getRng());
|
|
21296
21240
|
return fromPosition(forward, editor.getBody(), fromPos).filter(pos => forward ? isBeforeImageBlock(pos) : isAfterImageBlock(pos)).bind(pos => getChildNodeAtRelativeOffset(forward ? 0 : -1, pos)).map(elm => () => editor.selection.select(elm));
|
|
21297
21241
|
};
|
|
21298
|
-
const backspaceDelete$
|
|
21242
|
+
const backspaceDelete$4 = (editor, forward) => editor.selection.isCollapsed() ? deleteCaret$2(editor, forward) : Optional.none();
|
|
21299
21243
|
|
|
21300
21244
|
const isText$2 = isText$a;
|
|
21301
21245
|
const startsWithCaretContainer = node => isText$2(node) && node.data[0] === ZWSP$1;
|
|
@@ -21305,7 +21249,7 @@
|
|
|
21305
21249
|
const doc = (_a = node.ownerDocument) !== null && _a !== void 0 ? _a : document;
|
|
21306
21250
|
return doc.createTextNode(ZWSP$1);
|
|
21307
21251
|
};
|
|
21308
|
-
const insertBefore
|
|
21252
|
+
const insertBefore = node => {
|
|
21309
21253
|
var _a;
|
|
21310
21254
|
if (isText$2(node.previousSibling)) {
|
|
21311
21255
|
if (endsWithCaretContainer(node.previousSibling)) {
|
|
@@ -21327,7 +21271,7 @@
|
|
|
21327
21271
|
return newNode;
|
|
21328
21272
|
}
|
|
21329
21273
|
};
|
|
21330
|
-
const insertAfter
|
|
21274
|
+
const insertAfter = node => {
|
|
21331
21275
|
var _a, _b;
|
|
21332
21276
|
if (isText$2(node.nextSibling)) {
|
|
21333
21277
|
if (startsWithCaretContainer(node.nextSibling)) {
|
|
@@ -21353,7 +21297,7 @@
|
|
|
21353
21297
|
return newNode;
|
|
21354
21298
|
}
|
|
21355
21299
|
};
|
|
21356
|
-
const insertInline = (before, node) => before ? insertBefore
|
|
21300
|
+
const insertInline = (before, node) => before ? insertBefore(node) : insertAfter(node);
|
|
21357
21301
|
const insertInlineBefore = curry(insertInline, true);
|
|
21358
21302
|
const insertInlineAfter = curry(insertInline, false);
|
|
21359
21303
|
|
|
@@ -21903,7 +21847,7 @@
|
|
|
21903
21847
|
});
|
|
21904
21848
|
}
|
|
21905
21849
|
};
|
|
21906
|
-
const move$
|
|
21850
|
+
const move$2 = (editor, caret, forward) => isInlineBoundariesEnabled(editor) ? findLocation(editor, caret, forward).isSome() : false;
|
|
21907
21851
|
const moveWord = (forward, editor, _caret) => isInlineBoundariesEnabled(editor) ? moveByWord(forward, editor) : false;
|
|
21908
21852
|
const setupSelectedState = editor => {
|
|
21909
21853
|
const caret = Cell(null);
|
|
@@ -21996,7 +21940,7 @@
|
|
|
21996
21940
|
})));
|
|
21997
21941
|
});
|
|
21998
21942
|
};
|
|
21999
|
-
const backspaceDelete$
|
|
21943
|
+
const backspaceDelete$3 = (editor, caret, forward) => {
|
|
22000
21944
|
if (editor.selection.isCollapsed() && isInlineBoundariesEnabled(editor)) {
|
|
22001
21945
|
const from = CaretPosition.fromRangeStart(editor.selection.getRng());
|
|
22002
21946
|
return backspaceDeleteCollapsed(editor, caret, forward, from);
|
|
@@ -22091,7 +22035,7 @@
|
|
|
22091
22035
|
return Optional.none();
|
|
22092
22036
|
}
|
|
22093
22037
|
};
|
|
22094
|
-
const backspaceDelete$
|
|
22038
|
+
const backspaceDelete$2 = (editor, forward) => editor.selection.isCollapsed() ? deleteCaret$1(editor, forward) : deleteRange$1(editor);
|
|
22095
22039
|
const hasAncestorInlineCaret = elm => ancestor$1(elm, node => isCaretNode(node.dom), isBlock$2);
|
|
22096
22040
|
const hasAncestorInlineCaretAtStart = editor => hasAncestorInlineCaret(SugarElement.fromDom(editor.selection.getStart()));
|
|
22097
22041
|
const requiresRefreshCaretOverride = editor => {
|
|
@@ -22129,7 +22073,7 @@
|
|
|
22129
22073
|
const selectedNode = editor.selection.getNode();
|
|
22130
22074
|
return isMedia$2(selectedNode) ? deleteElement(editor, forward, selectedNode) : Optional.none();
|
|
22131
22075
|
};
|
|
22132
|
-
const backspaceDelete$
|
|
22076
|
+
const backspaceDelete$1 = (editor, forward) => editor.selection.isCollapsed() ? deleteCaret(editor, forward) : deleteRange(editor, forward);
|
|
22133
22077
|
|
|
22134
22078
|
const isEditable = target => closest$4(target, elm => isContentEditableTrue$3(elm.dom) || isContentEditableFalse$b(elm.dom)).exists(elm => isContentEditableTrue$3(elm.dom));
|
|
22135
22079
|
const parseIndentValue = value => toInt(value !== null && value !== void 0 ? value : '').getOr(0);
|
|
@@ -22176,7 +22120,7 @@
|
|
|
22176
22120
|
const indent = editor => handle(editor, 'indent');
|
|
22177
22121
|
const outdent = editor => handle(editor, 'outdent');
|
|
22178
22122
|
|
|
22179
|
-
const backspaceDelete
|
|
22123
|
+
const backspaceDelete = editor => {
|
|
22180
22124
|
if (editor.selection.isCollapsed() && canOutdent(editor)) {
|
|
22181
22125
|
const dom = editor.dom;
|
|
22182
22126
|
const rng = editor.selection.getRng();
|
|
@@ -22190,16 +22134,16 @@
|
|
|
22190
22134
|
};
|
|
22191
22135
|
|
|
22192
22136
|
const findAction = (editor, caret, forward) => findMap([
|
|
22193
|
-
backspaceDelete
|
|
22194
|
-
backspaceDelete$6,
|
|
22195
|
-
backspaceDelete$7,
|
|
22196
|
-
(editor, forward) => backspaceDelete$4(editor, caret, forward),
|
|
22197
|
-
backspaceDelete$9,
|
|
22198
|
-
backspaceDelete$a,
|
|
22137
|
+
backspaceDelete,
|
|
22199
22138
|
backspaceDelete$5,
|
|
22200
|
-
backspaceDelete$
|
|
22139
|
+
backspaceDelete$6,
|
|
22140
|
+
(editor, forward) => backspaceDelete$3(editor, caret, forward),
|
|
22201
22141
|
backspaceDelete$8,
|
|
22202
|
-
backspaceDelete$
|
|
22142
|
+
backspaceDelete$9,
|
|
22143
|
+
backspaceDelete$4,
|
|
22144
|
+
backspaceDelete$1,
|
|
22145
|
+
backspaceDelete$7,
|
|
22146
|
+
backspaceDelete$2
|
|
22203
22147
|
], item => item(editor, forward)).filter(_ => editor.selection.isEditable());
|
|
22204
22148
|
const deleteCommand = (editor, caret) => {
|
|
22205
22149
|
const result = findAction(editor, caret, false);
|
|
@@ -22536,7 +22480,7 @@
|
|
|
22536
22480
|
moveToRange(editor, newRange);
|
|
22537
22481
|
return true;
|
|
22538
22482
|
});
|
|
22539
|
-
const moveV$
|
|
22483
|
+
const moveV$3 = (editor, down) => getVerticalRange(editor, down).exists(newRange => {
|
|
22540
22484
|
moveToRange(editor, newRange);
|
|
22541
22485
|
return true;
|
|
22542
22486
|
});
|
|
@@ -22578,7 +22522,7 @@
|
|
|
22578
22522
|
}
|
|
22579
22523
|
});
|
|
22580
22524
|
};
|
|
22581
|
-
const moveV$
|
|
22525
|
+
const moveV$2 = (editor, forward) => {
|
|
22582
22526
|
if (editor.selection.isCollapsed()) {
|
|
22583
22527
|
return moveCaretToNewEmptyLine(editor, forward);
|
|
22584
22528
|
} else {
|
|
@@ -22586,37 +22530,6 @@
|
|
|
22586
22530
|
}
|
|
22587
22531
|
};
|
|
22588
22532
|
|
|
22589
|
-
const moveUp = (editor, details, summary) => {
|
|
22590
|
-
const rng = editor.selection.getRng();
|
|
22591
|
-
const pos = CaretPosition.fromRangeStart(rng);
|
|
22592
|
-
const root = editor.getBody();
|
|
22593
|
-
if (root.firstChild === details && isAtFirstLine(summary, pos)) {
|
|
22594
|
-
editor.execCommand('InsertNewBlockBefore');
|
|
22595
|
-
return true;
|
|
22596
|
-
} else {
|
|
22597
|
-
return false;
|
|
22598
|
-
}
|
|
22599
|
-
};
|
|
22600
|
-
const moveDown = (editor, details) => {
|
|
22601
|
-
const rng = editor.selection.getRng();
|
|
22602
|
-
const pos = CaretPosition.fromRangeStart(rng);
|
|
22603
|
-
const root = editor.getBody();
|
|
22604
|
-
if (root.lastChild === details && isAtLastLine(details, pos)) {
|
|
22605
|
-
editor.execCommand('InsertNewBlockAfter');
|
|
22606
|
-
return true;
|
|
22607
|
-
} else {
|
|
22608
|
-
return false;
|
|
22609
|
-
}
|
|
22610
|
-
};
|
|
22611
|
-
const move$2 = (editor, forward) => {
|
|
22612
|
-
if (forward) {
|
|
22613
|
-
return Optional.from(editor.dom.getParent(editor.selection.getNode(), 'details')).map(details => moveDown(editor, details)).getOr(false);
|
|
22614
|
-
} else {
|
|
22615
|
-
return Optional.from(editor.dom.getParent(editor.selection.getNode(), 'summary')).bind(summary => Optional.from(editor.dom.getParent(summary, 'details')).map(details => moveUp(editor, details, summary))).getOr(false);
|
|
22616
|
-
}
|
|
22617
|
-
};
|
|
22618
|
-
const moveV$2 = (editor, forward) => move$2(editor, forward);
|
|
22619
|
-
|
|
22620
22533
|
const baseKeyPattern = {
|
|
22621
22534
|
shiftKey: false,
|
|
22622
22535
|
altKey: false,
|
|
@@ -22909,11 +22822,11 @@
|
|
|
22909
22822
|
},
|
|
22910
22823
|
{
|
|
22911
22824
|
keyCode: VK.UP,
|
|
22912
|
-
action: action(moveV$
|
|
22825
|
+
action: action(moveV$3, editor, false)
|
|
22913
22826
|
},
|
|
22914
22827
|
{
|
|
22915
22828
|
keyCode: VK.DOWN,
|
|
22916
|
-
action: action(moveV$
|
|
22829
|
+
action: action(moveV$3, editor, true)
|
|
22917
22830
|
},
|
|
22918
22831
|
...isMac ? [
|
|
22919
22832
|
{
|
|
@@ -22945,18 +22858,6 @@
|
|
|
22945
22858
|
keyCode: VK.DOWN,
|
|
22946
22859
|
action: action(moveV, editor, true)
|
|
22947
22860
|
},
|
|
22948
|
-
{
|
|
22949
|
-
keyCode: VK.UP,
|
|
22950
|
-
action: action(moveV, editor, false)
|
|
22951
|
-
},
|
|
22952
|
-
{
|
|
22953
|
-
keyCode: VK.UP,
|
|
22954
|
-
action: action(moveV$2, editor, false)
|
|
22955
|
-
},
|
|
22956
|
-
{
|
|
22957
|
-
keyCode: VK.DOWN,
|
|
22958
|
-
action: action(moveV$2, editor, true)
|
|
22959
|
-
},
|
|
22960
22861
|
{
|
|
22961
22862
|
keyCode: VK.RIGHT,
|
|
22962
22863
|
action: action(moveH$1, editor, true)
|
|
@@ -22975,11 +22876,11 @@
|
|
|
22975
22876
|
},
|
|
22976
22877
|
{
|
|
22977
22878
|
keyCode: VK.RIGHT,
|
|
22978
|
-
action: action(move$
|
|
22879
|
+
action: action(move$2, editor, caret, true)
|
|
22979
22880
|
},
|
|
22980
22881
|
{
|
|
22981
22882
|
keyCode: VK.LEFT,
|
|
22982
|
-
action: action(move$
|
|
22883
|
+
action: action(move$2, editor, caret, false)
|
|
22983
22884
|
},
|
|
22984
22885
|
{
|
|
22985
22886
|
keyCode: VK.RIGHT,
|
|
@@ -22995,11 +22896,11 @@
|
|
|
22995
22896
|
},
|
|
22996
22897
|
{
|
|
22997
22898
|
keyCode: VK.UP,
|
|
22998
|
-
action: action(moveV$
|
|
22899
|
+
action: action(moveV$2, editor, false)
|
|
22999
22900
|
},
|
|
23000
22901
|
{
|
|
23001
22902
|
keyCode: VK.DOWN,
|
|
23002
|
-
action: action(moveV$
|
|
22903
|
+
action: action(moveV$2, editor, true)
|
|
23003
22904
|
}
|
|
23004
22905
|
], evt).each(_ => {
|
|
23005
22906
|
evt.preventDefault();
|
|
@@ -23696,184 +23597,6 @@
|
|
|
23696
23597
|
});
|
|
23697
23598
|
};
|
|
23698
23599
|
|
|
23699
|
-
const browser$1 = detect$2().browser;
|
|
23700
|
-
const isSafari = browser$1.isSafari();
|
|
23701
|
-
const emptyNodeContents = node => fillWithPaddingBr(SugarElement.fromDom(node));
|
|
23702
|
-
const isEntireNodeSelected = (rng, node) => {
|
|
23703
|
-
var _a;
|
|
23704
|
-
return rng.startOffset === 0 && rng.endOffset === ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.length);
|
|
23705
|
-
};
|
|
23706
|
-
const getParentDetailsElementAtPos = (dom, pos) => Optional.from(dom.getParent(pos.container(), 'details'));
|
|
23707
|
-
const isInDetailsElement = (dom, pos) => getParentDetailsElementAtPos(dom, pos).isSome();
|
|
23708
|
-
const getDetailsElements = (dom, rng) => {
|
|
23709
|
-
const startDetails = Optional.from(dom.getParent(rng.startContainer, 'details'));
|
|
23710
|
-
const endDetails = Optional.from(dom.getParent(rng.endContainer, 'details'));
|
|
23711
|
-
if (startDetails.isSome() || endDetails.isSome()) {
|
|
23712
|
-
const startSummary = startDetails.bind(details => Optional.from(dom.select('summary', details)[0]));
|
|
23713
|
-
return Optional.some({
|
|
23714
|
-
startSummary,
|
|
23715
|
-
startDetails,
|
|
23716
|
-
endDetails
|
|
23717
|
-
});
|
|
23718
|
-
} else {
|
|
23719
|
-
return Optional.none();
|
|
23720
|
-
}
|
|
23721
|
-
};
|
|
23722
|
-
const isCaretInTheBeginningOf = (caretPos, element) => firstPositionIn(element).exists(pos => pos.isEqual(caretPos));
|
|
23723
|
-
const isCaretInTheEndOf = (caretPos, element) => {
|
|
23724
|
-
return lastPositionIn(element).exists(pos => {
|
|
23725
|
-
if (isBr$6(pos.getNode())) {
|
|
23726
|
-
return prevPosition(element, pos).exists(pos2 => pos2.isEqual(caretPos)) || pos.isEqual(caretPos);
|
|
23727
|
-
} else {
|
|
23728
|
-
return pos.isEqual(caretPos);
|
|
23729
|
-
}
|
|
23730
|
-
});
|
|
23731
|
-
};
|
|
23732
|
-
const isCaretAtStartOfSummary = (caretPos, detailsElements) => detailsElements.startSummary.exists(summary => isCaretInTheBeginningOf(caretPos, summary));
|
|
23733
|
-
const isCaretAtEndOfSummary = (caretPos, detailsElements) => detailsElements.startSummary.exists(summary => isCaretInTheEndOf(caretPos, summary));
|
|
23734
|
-
const isCaretInFirstPositionInBody = (caretPos, detailsElements) => detailsElements.startDetails.exists(details => prevPosition(details, caretPos).forall(pos => detailsElements.startSummary.exists(summary => !summary.contains(caretPos.container()) && summary.contains(pos.container()))));
|
|
23735
|
-
const isCaretInLastPositionInBody = (root, caretPos, detailsElements) => detailsElements.startDetails.exists(details => nextPosition(root, caretPos).forall(pos => !details.contains(pos.container())));
|
|
23736
|
-
const setCaretToPosition = (editor, position) => {
|
|
23737
|
-
const node = position.getNode();
|
|
23738
|
-
if (!isUndefined(node)) {
|
|
23739
|
-
editor.selection.setCursorLocation(node, position.offset());
|
|
23740
|
-
}
|
|
23741
|
-
};
|
|
23742
|
-
const moveCaretToDetailsPos = (editor, pos, forward) => {
|
|
23743
|
-
const details = editor.dom.getParent(pos.container(), 'details');
|
|
23744
|
-
if (details && !details.open) {
|
|
23745
|
-
const summary = editor.dom.select('summary', details)[0];
|
|
23746
|
-
if (summary) {
|
|
23747
|
-
const newPos = forward ? firstPositionIn(summary) : lastPositionIn(summary);
|
|
23748
|
-
newPos.each(pos => setCaretToPosition(editor, pos));
|
|
23749
|
-
}
|
|
23750
|
-
} else {
|
|
23751
|
-
setCaretToPosition(editor, pos);
|
|
23752
|
-
}
|
|
23753
|
-
};
|
|
23754
|
-
const isPartialDelete = (rng, detailsElements) => {
|
|
23755
|
-
const containsStart = element => element.contains(rng.startContainer);
|
|
23756
|
-
const containsEnd = element => element.contains(rng.endContainer);
|
|
23757
|
-
const startInSummary = detailsElements.startSummary.exists(containsStart);
|
|
23758
|
-
const endInSummary = detailsElements.startSummary.exists(containsEnd);
|
|
23759
|
-
const isPartiallySelectedDetailsElements = detailsElements.startDetails.forall(startDetails => detailsElements.endDetails.forall(endDetails => startDetails !== endDetails));
|
|
23760
|
-
const isInPartiallySelectedSummary = (startInSummary || endInSummary) && !(startInSummary && endInSummary);
|
|
23761
|
-
return isInPartiallySelectedSummary || isPartiallySelectedDetailsElements;
|
|
23762
|
-
};
|
|
23763
|
-
const shouldPreventDeleteIntoDetails = (editor, forward, granularity) => {
|
|
23764
|
-
const {dom, selection} = editor;
|
|
23765
|
-
const root = editor.getBody();
|
|
23766
|
-
if (granularity === 'character') {
|
|
23767
|
-
const caretPos = CaretPosition.fromRangeStart(selection.getRng());
|
|
23768
|
-
const parentBlock = dom.getParent(caretPos.container(), dom.isBlock);
|
|
23769
|
-
const parentDetailsAtCaret = getParentDetailsElementAtPos(dom, caretPos);
|
|
23770
|
-
const inEmptyParentBlock = parentBlock && dom.isEmpty(parentBlock);
|
|
23771
|
-
const isFirstBlock = isNull(parentBlock === null || parentBlock === void 0 ? void 0 : parentBlock.previousSibling);
|
|
23772
|
-
const isLastBlock = isNull(parentBlock === null || parentBlock === void 0 ? void 0 : parentBlock.nextSibling);
|
|
23773
|
-
if (inEmptyParentBlock) {
|
|
23774
|
-
const firstOrLast = forward ? isLastBlock : isFirstBlock;
|
|
23775
|
-
if (firstOrLast) {
|
|
23776
|
-
const isBeforeAfterDetails = navigate(!forward, root, caretPos).exists(pos => {
|
|
23777
|
-
return isInDetailsElement(dom, pos) && !equals(parentDetailsAtCaret, getParentDetailsElementAtPos(dom, pos));
|
|
23778
|
-
});
|
|
23779
|
-
if (isBeforeAfterDetails) {
|
|
23780
|
-
return true;
|
|
23781
|
-
}
|
|
23782
|
-
}
|
|
23783
|
-
}
|
|
23784
|
-
return navigate(forward, root, caretPos).fold(never, pos => {
|
|
23785
|
-
const parentDetailsAtNewPos = getParentDetailsElementAtPos(dom, pos);
|
|
23786
|
-
if (isInDetailsElement(dom, pos) && !equals(parentDetailsAtCaret, parentDetailsAtNewPos)) {
|
|
23787
|
-
if (!forward) {
|
|
23788
|
-
moveCaretToDetailsPos(editor, pos, false);
|
|
23789
|
-
}
|
|
23790
|
-
if (parentBlock && inEmptyParentBlock) {
|
|
23791
|
-
if (forward && isFirstBlock) {
|
|
23792
|
-
return true;
|
|
23793
|
-
} else if (!forward && isLastBlock) {
|
|
23794
|
-
return true;
|
|
23795
|
-
}
|
|
23796
|
-
moveCaretToDetailsPos(editor, pos, forward);
|
|
23797
|
-
editor.dom.remove(parentBlock);
|
|
23798
|
-
}
|
|
23799
|
-
return true;
|
|
23800
|
-
} else {
|
|
23801
|
-
return false;
|
|
23802
|
-
}
|
|
23803
|
-
});
|
|
23804
|
-
} else {
|
|
23805
|
-
return false;
|
|
23806
|
-
}
|
|
23807
|
-
};
|
|
23808
|
-
const shouldPreventDeleteSummaryAction = (editor, detailElements, forward, granularity) => {
|
|
23809
|
-
const selection = editor.selection;
|
|
23810
|
-
const rng = selection.getRng();
|
|
23811
|
-
const caretPos = CaretPosition.fromRangeStart(rng);
|
|
23812
|
-
const root = editor.getBody();
|
|
23813
|
-
if (granularity === 'selection') {
|
|
23814
|
-
return isPartialDelete(rng, detailElements);
|
|
23815
|
-
} else if (forward) {
|
|
23816
|
-
return isCaretAtEndOfSummary(caretPos, detailElements) || isCaretInLastPositionInBody(root, caretPos, detailElements);
|
|
23817
|
-
} else {
|
|
23818
|
-
return isCaretAtStartOfSummary(caretPos, detailElements) || isCaretInFirstPositionInBody(caretPos, detailElements);
|
|
23819
|
-
}
|
|
23820
|
-
};
|
|
23821
|
-
const shouldPreventDeleteAction = (editor, forward, granularity) => getDetailsElements(editor.dom, editor.selection.getRng()).fold(() => shouldPreventDeleteIntoDetails(editor, forward, granularity), detailsElements => shouldPreventDeleteSummaryAction(editor, detailsElements, forward, granularity) || shouldPreventDeleteIntoDetails(editor, forward, granularity));
|
|
23822
|
-
const handleDeleteActionSafari = (editor, forward, granularity) => {
|
|
23823
|
-
const selection = editor.selection;
|
|
23824
|
-
const node = selection.getNode();
|
|
23825
|
-
const rng = selection.getRng();
|
|
23826
|
-
const caretPos = CaretPosition.fromRangeStart(rng);
|
|
23827
|
-
if (isSummary(node)) {
|
|
23828
|
-
if (granularity === 'selection' && isEntireNodeSelected(rng, node) || willDeleteLastPositionInElement(forward, caretPos, node)) {
|
|
23829
|
-
emptyNodeContents(node);
|
|
23830
|
-
} else {
|
|
23831
|
-
editor.undoManager.transact(() => {
|
|
23832
|
-
const sel = selection.getSel();
|
|
23833
|
-
let {anchorNode, anchorOffset, focusNode, focusOffset} = sel !== null && sel !== void 0 ? sel : {};
|
|
23834
|
-
const applySelection = () => {
|
|
23835
|
-
if (isNonNullable(anchorNode) && isNonNullable(anchorOffset) && isNonNullable(focusNode) && isNonNullable(focusOffset)) {
|
|
23836
|
-
sel === null || sel === void 0 ? void 0 : sel.setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset);
|
|
23837
|
-
}
|
|
23838
|
-
};
|
|
23839
|
-
const updateSelection = () => {
|
|
23840
|
-
anchorNode = sel === null || sel === void 0 ? void 0 : sel.anchorNode;
|
|
23841
|
-
anchorOffset = sel === null || sel === void 0 ? void 0 : sel.anchorOffset;
|
|
23842
|
-
focusNode = sel === null || sel === void 0 ? void 0 : sel.focusNode;
|
|
23843
|
-
focusOffset = sel === null || sel === void 0 ? void 0 : sel.focusOffset;
|
|
23844
|
-
};
|
|
23845
|
-
const appendAllChildNodes = (from, to) => {
|
|
23846
|
-
each$e(from.childNodes, child => {
|
|
23847
|
-
if (isNode(child)) {
|
|
23848
|
-
to.appendChild(child);
|
|
23849
|
-
}
|
|
23850
|
-
});
|
|
23851
|
-
};
|
|
23852
|
-
const container = editor.dom.create('span', { 'data-mce-bogus': '1' });
|
|
23853
|
-
appendAllChildNodes(node, container);
|
|
23854
|
-
node.appendChild(container);
|
|
23855
|
-
applySelection();
|
|
23856
|
-
if (granularity === 'word' || granularity === 'line') {
|
|
23857
|
-
sel === null || sel === void 0 ? void 0 : sel.modify('extend', forward ? 'right' : 'left', granularity);
|
|
23858
|
-
}
|
|
23859
|
-
if (!selection.isCollapsed() && isEntireNodeSelected(selection.getRng(), container)) {
|
|
23860
|
-
emptyNodeContents(node);
|
|
23861
|
-
} else {
|
|
23862
|
-
editor.execCommand(forward ? 'ForwardDelete' : 'Delete');
|
|
23863
|
-
updateSelection();
|
|
23864
|
-
appendAllChildNodes(container, node);
|
|
23865
|
-
applySelection();
|
|
23866
|
-
}
|
|
23867
|
-
editor.dom.remove(container);
|
|
23868
|
-
});
|
|
23869
|
-
}
|
|
23870
|
-
return true;
|
|
23871
|
-
} else {
|
|
23872
|
-
return false;
|
|
23873
|
-
}
|
|
23874
|
-
};
|
|
23875
|
-
const backspaceDelete = (editor, forward, granularity) => shouldPreventDeleteAction(editor, forward, granularity) || isSafari && handleDeleteActionSafari(editor, forward, granularity) ? Optional.some(noop) : Optional.none();
|
|
23876
|
-
|
|
23877
23600
|
const createAndFireInputEvent = eventType => (editor, inputType, specifics = {}) => {
|
|
23878
23601
|
const target = editor.getBody();
|
|
23879
23602
|
const overrides = {
|
|
@@ -23904,110 +23627,68 @@
|
|
|
23904
23627
|
const fireInputEvent = createAndFireInputEvent('input');
|
|
23905
23628
|
const fireBeforeInputEvent = createAndFireInputEvent('beforeinput');
|
|
23906
23629
|
|
|
23907
|
-
const platform$2 = detect$2();
|
|
23908
|
-
const os = platform$2.os;
|
|
23909
|
-
const isMacOSOriOS = os.isMacOS() || os.isiOS();
|
|
23910
|
-
const browser = platform$2.browser;
|
|
23911
|
-
const isFirefox = browser.isFirefox();
|
|
23912
23630
|
const executeKeydownOverride$3 = (editor, caret, evt) => {
|
|
23913
23631
|
const inputType = evt.keyCode === VK.BACKSPACE ? 'deleteContentBackward' : 'deleteContentForward';
|
|
23914
|
-
const isCollapsed = editor.selection.isCollapsed();
|
|
23915
|
-
const unmodifiedGranularity = isCollapsed ? 'character' : 'selection';
|
|
23916
|
-
const getModifiedGranularity = isWord => {
|
|
23917
|
-
if (isCollapsed) {
|
|
23918
|
-
return isWord ? 'word' : 'line';
|
|
23919
|
-
} else {
|
|
23920
|
-
return 'selection';
|
|
23921
|
-
}
|
|
23922
|
-
};
|
|
23923
23632
|
executeWithDelayedAction([
|
|
23924
23633
|
{
|
|
23925
23634
|
keyCode: VK.BACKSPACE,
|
|
23926
|
-
action: action(backspaceDelete
|
|
23635
|
+
action: action(backspaceDelete, editor)
|
|
23927
23636
|
},
|
|
23928
23637
|
{
|
|
23929
23638
|
keyCode: VK.BACKSPACE,
|
|
23930
|
-
action: action(backspaceDelete$
|
|
23639
|
+
action: action(backspaceDelete$5, editor, false)
|
|
23931
23640
|
},
|
|
23932
23641
|
{
|
|
23933
23642
|
keyCode: VK.DELETE,
|
|
23934
|
-
action: action(backspaceDelete$
|
|
23643
|
+
action: action(backspaceDelete$5, editor, true)
|
|
23935
23644
|
},
|
|
23936
23645
|
{
|
|
23937
23646
|
keyCode: VK.BACKSPACE,
|
|
23938
|
-
action: action(backspaceDelete$
|
|
23647
|
+
action: action(backspaceDelete$6, editor, false)
|
|
23939
23648
|
},
|
|
23940
23649
|
{
|
|
23941
23650
|
keyCode: VK.DELETE,
|
|
23942
|
-
action: action(backspaceDelete$
|
|
23651
|
+
action: action(backspaceDelete$6, editor, true)
|
|
23943
23652
|
},
|
|
23944
23653
|
{
|
|
23945
23654
|
keyCode: VK.BACKSPACE,
|
|
23946
|
-
action: action(backspaceDelete$
|
|
23655
|
+
action: action(backspaceDelete$3, editor, caret, false)
|
|
23947
23656
|
},
|
|
23948
23657
|
{
|
|
23949
23658
|
keyCode: VK.DELETE,
|
|
23950
|
-
action: action(backspaceDelete$
|
|
23659
|
+
action: action(backspaceDelete$3, editor, caret, true)
|
|
23951
23660
|
},
|
|
23952
23661
|
{
|
|
23953
23662
|
keyCode: VK.BACKSPACE,
|
|
23954
|
-
action: action(backspaceDelete$
|
|
23663
|
+
action: action(backspaceDelete$9, editor, false)
|
|
23955
23664
|
},
|
|
23956
23665
|
{
|
|
23957
23666
|
keyCode: VK.DELETE,
|
|
23958
|
-
action: action(backspaceDelete$
|
|
23667
|
+
action: action(backspaceDelete$9, editor, true)
|
|
23959
23668
|
},
|
|
23960
23669
|
{
|
|
23961
23670
|
keyCode: VK.BACKSPACE,
|
|
23962
|
-
action: action(backspaceDelete, editor, false
|
|
23671
|
+
action: action(backspaceDelete$4, editor, false)
|
|
23963
23672
|
},
|
|
23964
23673
|
{
|
|
23965
23674
|
keyCode: VK.DELETE,
|
|
23966
|
-
action: action(backspaceDelete, editor, true
|
|
23675
|
+
action: action(backspaceDelete$4, editor, true)
|
|
23967
23676
|
},
|
|
23968
|
-
...isMacOSOriOS ? [
|
|
23969
|
-
{
|
|
23970
|
-
keyCode: VK.BACKSPACE,
|
|
23971
|
-
altKey: true,
|
|
23972
|
-
action: action(backspaceDelete, editor, false, getModifiedGranularity(true))
|
|
23973
|
-
},
|
|
23974
|
-
{
|
|
23975
|
-
keyCode: VK.DELETE,
|
|
23976
|
-
altKey: true,
|
|
23977
|
-
action: action(backspaceDelete, editor, true, getModifiedGranularity(true))
|
|
23978
|
-
},
|
|
23979
|
-
{
|
|
23980
|
-
keyCode: VK.BACKSPACE,
|
|
23981
|
-
metaKey: true,
|
|
23982
|
-
action: action(backspaceDelete, editor, false, getModifiedGranularity(false))
|
|
23983
|
-
}
|
|
23984
|
-
] : [
|
|
23985
|
-
{
|
|
23986
|
-
keyCode: VK.BACKSPACE,
|
|
23987
|
-
ctrlKey: true,
|
|
23988
|
-
action: action(backspaceDelete, editor, false, getModifiedGranularity(true))
|
|
23989
|
-
},
|
|
23990
|
-
{
|
|
23991
|
-
keyCode: VK.DELETE,
|
|
23992
|
-
ctrlKey: true,
|
|
23993
|
-
action: action(backspaceDelete, editor, true, getModifiedGranularity(true))
|
|
23994
|
-
}
|
|
23995
|
-
],
|
|
23996
23677
|
{
|
|
23997
23678
|
keyCode: VK.BACKSPACE,
|
|
23998
|
-
action: action(backspaceDelete$
|
|
23679
|
+
action: action(backspaceDelete$1, editor, false)
|
|
23999
23680
|
},
|
|
24000
23681
|
{
|
|
24001
23682
|
keyCode: VK.DELETE,
|
|
24002
|
-
action: action(backspaceDelete$
|
|
23683
|
+
action: action(backspaceDelete$1, editor, true)
|
|
24003
23684
|
},
|
|
24004
23685
|
{
|
|
24005
23686
|
keyCode: VK.BACKSPACE,
|
|
24006
|
-
action: action(backspaceDelete$
|
|
23687
|
+
action: action(backspaceDelete$7, editor, false)
|
|
24007
23688
|
},
|
|
24008
23689
|
{
|
|
24009
23690
|
keyCode: VK.DELETE,
|
|
24010
|
-
action: action(backspaceDelete$
|
|
23691
|
+
action: action(backspaceDelete$7, editor, true)
|
|
24011
23692
|
},
|
|
24012
23693
|
{
|
|
24013
23694
|
keyCode: VK.BACKSPACE,
|
|
@@ -24019,19 +23700,11 @@
|
|
|
24019
23700
|
},
|
|
24020
23701
|
{
|
|
24021
23702
|
keyCode: VK.BACKSPACE,
|
|
24022
|
-
action: action(backspaceDelete$
|
|
24023
|
-
},
|
|
24024
|
-
{
|
|
24025
|
-
keyCode: VK.DELETE,
|
|
24026
|
-
action: action(backspaceDelete$9, editor, true)
|
|
24027
|
-
},
|
|
24028
|
-
{
|
|
24029
|
-
keyCode: VK.BACKSPACE,
|
|
24030
|
-
action: action(backspaceDelete$3, editor, false)
|
|
23703
|
+
action: action(backspaceDelete$2, editor, false)
|
|
24031
23704
|
},
|
|
24032
23705
|
{
|
|
24033
23706
|
keyCode: VK.DELETE,
|
|
24034
|
-
action: action(backspaceDelete$
|
|
23707
|
+
action: action(backspaceDelete$2, editor, true)
|
|
24035
23708
|
}
|
|
24036
23709
|
], evt).filter(_ => editor.selection.isEditable()).each(applyAction => {
|
|
24037
23710
|
evt.preventDefault();
|
|
@@ -24042,16 +23715,11 @@
|
|
|
24042
23715
|
}
|
|
24043
23716
|
});
|
|
24044
23717
|
};
|
|
24045
|
-
const executeKeyupOverride = (editor, evt, isBackspaceKeydown) =>
|
|
24046
|
-
|
|
24047
|
-
|
|
24048
|
-
|
|
24049
|
-
|
|
24050
|
-
{
|
|
24051
|
-
keyCode: VK.DELETE,
|
|
24052
|
-
action: action(paddEmptyElement, editor)
|
|
24053
|
-
},
|
|
24054
|
-
...isMacOSOriOS ? [
|
|
23718
|
+
const executeKeyupOverride = (editor, evt, isBackspaceKeydown) => {
|
|
23719
|
+
const platform = detect$2();
|
|
23720
|
+
const os = platform.os;
|
|
23721
|
+
const browser = platform.browser;
|
|
23722
|
+
const multiDeleteKeyPatterns = os.isMacOS() ? [
|
|
24055
23723
|
{
|
|
24056
23724
|
keyCode: VK.BACKSPACE,
|
|
24057
23725
|
altKey: true,
|
|
@@ -24061,11 +23729,7 @@
|
|
|
24061
23729
|
keyCode: VK.DELETE,
|
|
24062
23730
|
altKey: true,
|
|
24063
23731
|
action: action(refreshCaret, editor)
|
|
24064
|
-
}
|
|
24065
|
-
...isBackspaceKeydown ? [{
|
|
24066
|
-
keyCode: isFirefox ? 224 : 91,
|
|
24067
|
-
action: action(refreshCaret, editor)
|
|
24068
|
-
}] : []
|
|
23732
|
+
}
|
|
24069
23733
|
] : [
|
|
24070
23734
|
{
|
|
24071
23735
|
keyCode: VK.BACKSPACE,
|
|
@@ -24077,8 +23741,25 @@
|
|
|
24077
23741
|
ctrlKey: true,
|
|
24078
23742
|
action: action(refreshCaret, editor)
|
|
24079
23743
|
}
|
|
24080
|
-
]
|
|
24081
|
-
|
|
23744
|
+
];
|
|
23745
|
+
if (os.isMacOS() && isBackspaceKeydown) {
|
|
23746
|
+
multiDeleteKeyPatterns.push({
|
|
23747
|
+
keyCode: browser.isFirefox() ? 224 : 91,
|
|
23748
|
+
action: action(refreshCaret, editor)
|
|
23749
|
+
});
|
|
23750
|
+
}
|
|
23751
|
+
execute([
|
|
23752
|
+
{
|
|
23753
|
+
keyCode: VK.BACKSPACE,
|
|
23754
|
+
action: action(paddEmptyElement, editor)
|
|
23755
|
+
},
|
|
23756
|
+
{
|
|
23757
|
+
keyCode: VK.DELETE,
|
|
23758
|
+
action: action(paddEmptyElement, editor)
|
|
23759
|
+
},
|
|
23760
|
+
...multiDeleteKeyPatterns
|
|
23761
|
+
], evt);
|
|
23762
|
+
};
|
|
24082
23763
|
const setup$i = (editor, caret) => {
|
|
24083
23764
|
let isBackspaceKeydown = false;
|
|
24084
23765
|
editor.on('keydown', evt => {
|
|
@@ -24164,7 +23845,6 @@
|
|
|
24164
23845
|
while (parent !== root && parent && dom.getContentEditable(parent) !== 'false') {
|
|
24165
23846
|
if (dom.getContentEditable(parent) === 'true') {
|
|
24166
23847
|
editableRoot = parent;
|
|
24167
|
-
break;
|
|
24168
23848
|
}
|
|
24169
23849
|
parent = parent.parentNode;
|
|
24170
23850
|
}
|
|
@@ -24183,82 +23863,6 @@
|
|
|
24183
23863
|
return isListItem$1(SugarElement.fromDom(elm));
|
|
24184
23864
|
}).isSome();
|
|
24185
23865
|
};
|
|
24186
|
-
const emptyBlock = elm => {
|
|
24187
|
-
elm.innerHTML = '<br data-mce-bogus="1">';
|
|
24188
|
-
};
|
|
24189
|
-
const applyAttributes = (editor, node, forcedRootBlockAttrs) => {
|
|
24190
|
-
const dom = editor.dom;
|
|
24191
|
-
Optional.from(forcedRootBlockAttrs.style).map(dom.parseStyle).each(attrStyles => {
|
|
24192
|
-
const currentStyles = getAllRaw(SugarElement.fromDom(node));
|
|
24193
|
-
const newStyles = {
|
|
24194
|
-
...currentStyles,
|
|
24195
|
-
...attrStyles
|
|
24196
|
-
};
|
|
24197
|
-
dom.setStyles(node, newStyles);
|
|
24198
|
-
});
|
|
24199
|
-
const attrClassesOpt = Optional.from(forcedRootBlockAttrs.class).map(attrClasses => attrClasses.split(/\s+/));
|
|
24200
|
-
const currentClassesOpt = Optional.from(node.className).map(currentClasses => filter$5(currentClasses.split(/\s+/), clazz => clazz !== ''));
|
|
24201
|
-
lift2(attrClassesOpt, currentClassesOpt, (attrClasses, currentClasses) => {
|
|
24202
|
-
const filteredClasses = filter$5(currentClasses, clazz => !contains$2(attrClasses, clazz));
|
|
24203
|
-
const newClasses = [
|
|
24204
|
-
...attrClasses,
|
|
24205
|
-
...filteredClasses
|
|
24206
|
-
];
|
|
24207
|
-
dom.setAttrib(node, 'class', newClasses.join(' '));
|
|
24208
|
-
});
|
|
24209
|
-
const appliedAttrs = [
|
|
24210
|
-
'style',
|
|
24211
|
-
'class'
|
|
24212
|
-
];
|
|
24213
|
-
const remainingAttrs = filter$4(forcedRootBlockAttrs, (_, attrs) => !contains$2(appliedAttrs, attrs));
|
|
24214
|
-
dom.setAttribs(node, remainingAttrs);
|
|
24215
|
-
};
|
|
24216
|
-
const setForcedBlockAttrs = (editor, node) => {
|
|
24217
|
-
const forcedRootBlockName = getForcedRootBlock(editor);
|
|
24218
|
-
if (forcedRootBlockName.toLowerCase() === node.tagName.toLowerCase()) {
|
|
24219
|
-
const forcedRootBlockAttrs = getForcedRootBlockAttrs(editor);
|
|
24220
|
-
applyAttributes(editor, node, forcedRootBlockAttrs);
|
|
24221
|
-
}
|
|
24222
|
-
};
|
|
24223
|
-
const createNewBlock = (editor, container, parentBlock, editableRoot, keepStyles = true, name) => {
|
|
24224
|
-
const dom = editor.dom;
|
|
24225
|
-
const schema = editor.schema;
|
|
24226
|
-
const newBlockName = getForcedRootBlock(editor);
|
|
24227
|
-
const parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : '';
|
|
24228
|
-
let node = container;
|
|
24229
|
-
const textInlineElements = schema.getTextInlineElements();
|
|
24230
|
-
let block;
|
|
24231
|
-
if (name || parentBlockName === 'TABLE' || parentBlockName === 'HR') {
|
|
24232
|
-
block = dom.create(name || newBlockName);
|
|
24233
|
-
} else {
|
|
24234
|
-
block = parentBlock.cloneNode(false);
|
|
24235
|
-
}
|
|
24236
|
-
let caretNode = block;
|
|
24237
|
-
if (!keepStyles) {
|
|
24238
|
-
dom.setAttrib(block, 'style', null);
|
|
24239
|
-
dom.setAttrib(block, 'class', null);
|
|
24240
|
-
} else {
|
|
24241
|
-
do {
|
|
24242
|
-
if (textInlineElements[node.nodeName]) {
|
|
24243
|
-
if (isCaretNode(node) || isBookmarkNode$1(node)) {
|
|
24244
|
-
continue;
|
|
24245
|
-
}
|
|
24246
|
-
const clonedNode = node.cloneNode(false);
|
|
24247
|
-
dom.setAttrib(clonedNode, 'id', '');
|
|
24248
|
-
if (block.hasChildNodes()) {
|
|
24249
|
-
clonedNode.appendChild(block.firstChild);
|
|
24250
|
-
block.appendChild(clonedNode);
|
|
24251
|
-
} else {
|
|
24252
|
-
caretNode = clonedNode;
|
|
24253
|
-
block.appendChild(clonedNode);
|
|
24254
|
-
}
|
|
24255
|
-
}
|
|
24256
|
-
} while ((node = node.parentNode) && node !== editableRoot);
|
|
24257
|
-
}
|
|
24258
|
-
setForcedBlockAttrs(editor, block);
|
|
24259
|
-
emptyBlock(caretNode);
|
|
24260
|
-
return block;
|
|
24261
|
-
};
|
|
24262
23866
|
|
|
24263
23867
|
const getDetailsRoot = (editor, element) => editor.dom.getParent(element, isDetails);
|
|
24264
23868
|
const isAtDetailsEdge = (root, element, isTextBlock) => {
|
|
@@ -24321,7 +23925,7 @@
|
|
|
24321
23925
|
}
|
|
24322
23926
|
return node === parentBlock;
|
|
24323
23927
|
};
|
|
24324
|
-
const insert$
|
|
23928
|
+
const insert$3 = (editor, createNewBlock, containerBlock, parentBlock, newBlockName) => {
|
|
24325
23929
|
const dom = editor.dom;
|
|
24326
23930
|
const rng = editor.selection.getRng();
|
|
24327
23931
|
const containerParent = containerBlock.parentNode;
|
|
@@ -24387,6 +23991,9 @@
|
|
|
24387
23991
|
const isEmptyAnchor = (dom, elm) => {
|
|
24388
23992
|
return elm && elm.nodeName === 'A' && dom.isEmpty(elm);
|
|
24389
23993
|
};
|
|
23994
|
+
const emptyBlock = elm => {
|
|
23995
|
+
elm.innerHTML = '<br data-mce-bogus="1">';
|
|
23996
|
+
};
|
|
24390
23997
|
const containerAndSiblingName = (container, nodeName) => {
|
|
24391
23998
|
return container.nodeName === nodeName || container.previousSibling && container.previousSibling.nodeName === nodeName;
|
|
24392
23999
|
};
|
|
@@ -24444,6 +24051,40 @@
|
|
|
24444
24051
|
currentNode = currentNode.firstChild;
|
|
24445
24052
|
} while (currentNode);
|
|
24446
24053
|
};
|
|
24054
|
+
const applyAttributes = (editor, node, forcedRootBlockAttrs) => {
|
|
24055
|
+
const dom = editor.dom;
|
|
24056
|
+
Optional.from(forcedRootBlockAttrs.style).map(dom.parseStyle).each(attrStyles => {
|
|
24057
|
+
const currentStyles = getAllRaw(SugarElement.fromDom(node));
|
|
24058
|
+
const newStyles = {
|
|
24059
|
+
...currentStyles,
|
|
24060
|
+
...attrStyles
|
|
24061
|
+
};
|
|
24062
|
+
dom.setStyles(node, newStyles);
|
|
24063
|
+
});
|
|
24064
|
+
const attrClassesOpt = Optional.from(forcedRootBlockAttrs.class).map(attrClasses => attrClasses.split(/\s+/));
|
|
24065
|
+
const currentClassesOpt = Optional.from(node.className).map(currentClasses => filter$5(currentClasses.split(/\s+/), clazz => clazz !== ''));
|
|
24066
|
+
lift2(attrClassesOpt, currentClassesOpt, (attrClasses, currentClasses) => {
|
|
24067
|
+
const filteredClasses = filter$5(currentClasses, clazz => !contains$2(attrClasses, clazz));
|
|
24068
|
+
const newClasses = [
|
|
24069
|
+
...attrClasses,
|
|
24070
|
+
...filteredClasses
|
|
24071
|
+
];
|
|
24072
|
+
dom.setAttrib(node, 'class', newClasses.join(' '));
|
|
24073
|
+
});
|
|
24074
|
+
const appliedAttrs = [
|
|
24075
|
+
'style',
|
|
24076
|
+
'class'
|
|
24077
|
+
];
|
|
24078
|
+
const remainingAttrs = filter$4(forcedRootBlockAttrs, (_, attrs) => !contains$2(appliedAttrs, attrs));
|
|
24079
|
+
dom.setAttribs(node, remainingAttrs);
|
|
24080
|
+
};
|
|
24081
|
+
const setForcedBlockAttrs = (editor, node) => {
|
|
24082
|
+
const forcedRootBlockName = getForcedRootBlock(editor);
|
|
24083
|
+
if (forcedRootBlockName.toLowerCase() === node.tagName.toLowerCase()) {
|
|
24084
|
+
const forcedRootBlockAttrs = getForcedRootBlockAttrs(editor);
|
|
24085
|
+
applyAttributes(editor, node, forcedRootBlockAttrs);
|
|
24086
|
+
}
|
|
24087
|
+
};
|
|
24447
24088
|
const wrapSelfAndSiblingsInDefaultBlock = (editor, newBlockName, rng, container, offset) => {
|
|
24448
24089
|
var _a, _b;
|
|
24449
24090
|
const dom = editor.dom;
|
|
@@ -24503,7 +24144,7 @@
|
|
|
24503
24144
|
return optionValue;
|
|
24504
24145
|
}
|
|
24505
24146
|
};
|
|
24506
|
-
const insert$
|
|
24147
|
+
const insert$2 = (editor, evt) => {
|
|
24507
24148
|
let container;
|
|
24508
24149
|
let offset;
|
|
24509
24150
|
let parentBlockName;
|
|
@@ -24513,12 +24154,45 @@
|
|
|
24513
24154
|
const schema = editor.schema, nonEmptyElementsMap = schema.getNonEmptyElements();
|
|
24514
24155
|
const rng = editor.selection.getRng();
|
|
24515
24156
|
const newBlockName = getForcedRootBlock(editor);
|
|
24157
|
+
const isInRoot = rng.collapsed && rng.startContainer === editor.dom.getRoot();
|
|
24516
24158
|
const start = SugarElement.fromDom(rng.startContainer);
|
|
24517
24159
|
const child = child$1(start, rng.startOffset);
|
|
24518
24160
|
const isCef = child.exists(element => isHTMLElement(element) && !isEditable$3(element));
|
|
24519
|
-
const
|
|
24520
|
-
const createNewBlock
|
|
24521
|
-
|
|
24161
|
+
const inRootAndLastOrCef = isInRoot && isCef;
|
|
24162
|
+
const createNewBlock = name => {
|
|
24163
|
+
let node = container;
|
|
24164
|
+
const textInlineElements = schema.getTextInlineElements();
|
|
24165
|
+
let block;
|
|
24166
|
+
if (name || parentBlockName === 'TABLE' || parentBlockName === 'HR') {
|
|
24167
|
+
block = dom.create(name || newBlockName);
|
|
24168
|
+
} else {
|
|
24169
|
+
block = parentBlock.cloneNode(false);
|
|
24170
|
+
}
|
|
24171
|
+
let caretNode = block;
|
|
24172
|
+
if (shouldKeepStyles(editor) === false) {
|
|
24173
|
+
dom.setAttrib(block, 'style', null);
|
|
24174
|
+
dom.setAttrib(block, 'class', null);
|
|
24175
|
+
} else {
|
|
24176
|
+
do {
|
|
24177
|
+
if (textInlineElements[node.nodeName]) {
|
|
24178
|
+
if (isCaretNode(node) || isBookmarkNode$1(node)) {
|
|
24179
|
+
continue;
|
|
24180
|
+
}
|
|
24181
|
+
const clonedNode = node.cloneNode(false);
|
|
24182
|
+
dom.setAttrib(clonedNode, 'id', '');
|
|
24183
|
+
if (block.hasChildNodes()) {
|
|
24184
|
+
clonedNode.appendChild(block.firstChild);
|
|
24185
|
+
block.appendChild(clonedNode);
|
|
24186
|
+
} else {
|
|
24187
|
+
caretNode = clonedNode;
|
|
24188
|
+
block.appendChild(clonedNode);
|
|
24189
|
+
}
|
|
24190
|
+
}
|
|
24191
|
+
} while ((node = node.parentNode) && node !== editableRoot);
|
|
24192
|
+
}
|
|
24193
|
+
setForcedBlockAttrs(editor, block);
|
|
24194
|
+
emptyBlock(caretNode);
|
|
24195
|
+
return block;
|
|
24522
24196
|
};
|
|
24523
24197
|
const isCaretAtStartOrEndOfBlock = start => {
|
|
24524
24198
|
const normalizedOffset = normalizeZwspOffset(start, container, offset);
|
|
@@ -24565,9 +24239,9 @@
|
|
|
24565
24239
|
const insertNewBlockAfter = () => {
|
|
24566
24240
|
let block;
|
|
24567
24241
|
if (/^(H[1-6]|PRE|FIGURE)$/.test(parentBlockName) && containerBlockName !== 'HGROUP') {
|
|
24568
|
-
block = createNewBlock
|
|
24242
|
+
block = createNewBlock(newBlockName);
|
|
24569
24243
|
} else {
|
|
24570
|
-
block = createNewBlock
|
|
24244
|
+
block = createNewBlock();
|
|
24571
24245
|
}
|
|
24572
24246
|
if (shouldEndContainer(editor, containerBlock) && canSplitBlock(dom, containerBlock) && dom.isEmpty(parentBlock, undefined, { includeZwsp: true })) {
|
|
24573
24247
|
block = dom.split(containerBlock, parentBlock);
|
|
@@ -24585,7 +24259,7 @@
|
|
|
24585
24259
|
offset = rng.startOffset;
|
|
24586
24260
|
const shiftKey = !!(evt && evt.shiftKey);
|
|
24587
24261
|
const ctrlKey = !!(evt && evt.ctrlKey);
|
|
24588
|
-
if (isElement$6(container) && container.hasChildNodes() && !
|
|
24262
|
+
if (isElement$6(container) && container.hasChildNodes() && !inRootAndLastOrCef) {
|
|
24589
24263
|
isAfterLastNodeInContainer = offset > container.childNodes.length - 1;
|
|
24590
24264
|
container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
|
|
24591
24265
|
if (isAfterLastNodeInContainer && isText$a(container)) {
|
|
@@ -24612,21 +24286,21 @@
|
|
|
24612
24286
|
parentBlockName = containerBlockName;
|
|
24613
24287
|
}
|
|
24614
24288
|
if (isElement$6(containerBlock) && isLastEmptyBlockInDetails(editor, shiftKey, parentBlock)) {
|
|
24615
|
-
return insertNewLine(editor, createNewBlock
|
|
24289
|
+
return insertNewLine(editor, createNewBlock, parentBlock);
|
|
24616
24290
|
}
|
|
24617
24291
|
if (/^(LI|DT|DD)$/.test(parentBlockName) && isElement$6(containerBlock)) {
|
|
24618
24292
|
if (dom.isEmpty(parentBlock)) {
|
|
24619
|
-
insert$
|
|
24293
|
+
insert$3(editor, createNewBlock, containerBlock, parentBlock, newBlockName);
|
|
24620
24294
|
return;
|
|
24621
24295
|
}
|
|
24622
24296
|
}
|
|
24623
|
-
if (!
|
|
24297
|
+
if (!inRootAndLastOrCef && (parentBlock === editor.getBody() || !canSplitBlock(dom, parentBlock))) {
|
|
24624
24298
|
return;
|
|
24625
24299
|
}
|
|
24626
24300
|
const parentBlockParent = parentBlock.parentNode;
|
|
24627
24301
|
let newBlock;
|
|
24628
|
-
if (
|
|
24629
|
-
newBlock = createNewBlock
|
|
24302
|
+
if (inRootAndLastOrCef) {
|
|
24303
|
+
newBlock = createNewBlock(newBlockName);
|
|
24630
24304
|
child.fold(() => {
|
|
24631
24305
|
append$1(start, SugarElement.fromDom(newBlock));
|
|
24632
24306
|
}, child => {
|
|
@@ -24643,7 +24317,7 @@
|
|
|
24643
24317
|
} else if (isCaretAtStartOrEndOfBlock(false)) {
|
|
24644
24318
|
newBlock = insertNewBlockAfter();
|
|
24645
24319
|
} else if (isCaretAtStartOrEndOfBlock(true) && parentBlockParent) {
|
|
24646
|
-
newBlock = parentBlockParent.insertBefore(createNewBlock
|
|
24320
|
+
newBlock = parentBlockParent.insertBefore(createNewBlock(), parentBlock);
|
|
24647
24321
|
const isNearChildren = hasChildNodes(SugarElement.fromDom(rng.startContainer)) && rng.collapsed;
|
|
24648
24322
|
moveToCaretPosition(editor, containerAndSiblingName(parentBlock, 'HR') || isNearChildren ? newBlock : parentBlock);
|
|
24649
24323
|
} else {
|
|
@@ -24673,7 +24347,7 @@
|
|
|
24673
24347
|
};
|
|
24674
24348
|
const fakeEventName$1 = 'insertParagraph';
|
|
24675
24349
|
const blockbreak = {
|
|
24676
|
-
insert: insert$
|
|
24350
|
+
insert: insert$2,
|
|
24677
24351
|
fakeEventName: fakeEventName$1
|
|
24678
24352
|
};
|
|
24679
24353
|
|
|
@@ -24782,7 +24456,7 @@
|
|
|
24782
24456
|
const insertBrOutsideAnchor = (editor, location) => {
|
|
24783
24457
|
location.fold(noop, curry(insertBrBefore, editor), curry(insertBrAfter, editor), noop);
|
|
24784
24458
|
};
|
|
24785
|
-
const insert$
|
|
24459
|
+
const insert$1 = (editor, evt) => {
|
|
24786
24460
|
const anchorLocation = readInlineAnchorLocation(editor);
|
|
24787
24461
|
if (anchorLocation.isSome()) {
|
|
24788
24462
|
anchorLocation.each(curry(insertBrOutsideAnchor, editor));
|
|
@@ -24792,7 +24466,7 @@
|
|
|
24792
24466
|
};
|
|
24793
24467
|
const fakeEventName = 'insertLineBreak';
|
|
24794
24468
|
const linebreak = {
|
|
24795
|
-
insert: insert$
|
|
24469
|
+
insert: insert$1,
|
|
24796
24470
|
fakeEventName
|
|
24797
24471
|
};
|
|
24798
24472
|
|
|
@@ -24849,10 +24523,11 @@
|
|
|
24849
24523
|
};
|
|
24850
24524
|
const isInRootWithEmptyOrCEF = editor => {
|
|
24851
24525
|
const rng = editor.selection.getRng();
|
|
24526
|
+
const isInRoot = rng.collapsed && rng.startContainer === editor.dom.getRoot();
|
|
24852
24527
|
const start = SugarElement.fromDom(rng.startContainer);
|
|
24853
24528
|
const child = child$1(start, rng.startOffset);
|
|
24854
24529
|
const isCefOpt = child.map(element => isHTMLElement(element) && !isEditable$3(element));
|
|
24855
|
-
return
|
|
24530
|
+
return isInRoot && isCefOpt.getOr(true);
|
|
24856
24531
|
};
|
|
24857
24532
|
const match = (predicates, action) => {
|
|
24858
24533
|
return (editor, shiftKey) => {
|
|
@@ -24918,7 +24593,7 @@
|
|
|
24918
24593
|
fireInputEvent(editor, breakType.fakeEventName);
|
|
24919
24594
|
}
|
|
24920
24595
|
};
|
|
24921
|
-
const insert
|
|
24596
|
+
const insert = (editor, evt) => {
|
|
24922
24597
|
const br = () => insertBreak(linebreak, editor, evt);
|
|
24923
24598
|
const block = () => insertBreak(blockbreak, editor, evt);
|
|
24924
24599
|
const logicalAction = getAction(editor, evt);
|
|
@@ -24938,8 +24613,8 @@
|
|
|
24938
24613
|
}
|
|
24939
24614
|
};
|
|
24940
24615
|
|
|
24941
|
-
const platform$
|
|
24942
|
-
const isIOSSafari = platform$
|
|
24616
|
+
const platform$2 = detect$2();
|
|
24617
|
+
const isIOSSafari = platform$2.os.isiOS() && platform$2.browser.isSafari();
|
|
24943
24618
|
const handleEnterKeyEvent = (editor, event) => {
|
|
24944
24619
|
if (event.isDefaultPrevented()) {
|
|
24945
24620
|
return;
|
|
@@ -24947,7 +24622,7 @@
|
|
|
24947
24622
|
event.preventDefault();
|
|
24948
24623
|
endTypingLevelIgnoreLocks(editor.undoManager);
|
|
24949
24624
|
editor.undoManager.transact(() => {
|
|
24950
|
-
insert
|
|
24625
|
+
insert(editor, event);
|
|
24951
24626
|
});
|
|
24952
24627
|
};
|
|
24953
24628
|
const isCaretAfterKoreanCharacter = rng => {
|
|
@@ -25052,7 +24727,7 @@
|
|
|
25052
24727
|
});
|
|
25053
24728
|
};
|
|
25054
24729
|
|
|
25055
|
-
const platform = detect$2();
|
|
24730
|
+
const platform$1 = detect$2();
|
|
25056
24731
|
const executeKeyupAction = (editor, caret, evt) => {
|
|
25057
24732
|
execute([
|
|
25058
24733
|
{
|
|
@@ -25076,7 +24751,7 @@
|
|
|
25076
24751
|
blocked.set(block);
|
|
25077
24752
|
};
|
|
25078
24753
|
const setup$e = (editor, caret) => {
|
|
25079
|
-
if (platform.os.isMacOS()) {
|
|
24754
|
+
if (platform$1.os.isMacOS()) {
|
|
25080
24755
|
return;
|
|
25081
24756
|
}
|
|
25082
24757
|
const blocked = Cell(false);
|
|
@@ -26106,34 +25781,15 @@
|
|
|
26106
25781
|
}
|
|
26107
25782
|
};
|
|
26108
25783
|
const hasImage = dataTransfer => exists(dataTransfer.files, file => /^image\//.test(file.type));
|
|
26109
|
-
const
|
|
25784
|
+
const isTransparentBlockDrop = (dom, schema, target, dropContent) => {
|
|
26110
25785
|
const parentTransparent = dom.getParent(target, node => isTransparentBlock(schema, node));
|
|
26111
|
-
|
|
26112
|
-
if (inSummary) {
|
|
26113
|
-
return true;
|
|
26114
|
-
} else if (parentTransparent && has$2(dropContent, 'text/html')) {
|
|
25786
|
+
if (parentTransparent && has$2(dropContent, 'text/html')) {
|
|
26115
25787
|
const fragment = new DOMParser().parseFromString(dropContent['text/html'], 'text/html').body;
|
|
26116
25788
|
return !isNull(fragment.querySelector(parentTransparent.nodeName.toLowerCase()));
|
|
26117
25789
|
} else {
|
|
26118
25790
|
return false;
|
|
26119
25791
|
}
|
|
26120
25792
|
};
|
|
26121
|
-
const setupSummaryDeleteByDragFix = editor => {
|
|
26122
|
-
editor.on('input', e => {
|
|
26123
|
-
const hasNoSummary = el => isNull(el.querySelector('summary'));
|
|
26124
|
-
if (e.inputType === 'deleteByDrag') {
|
|
26125
|
-
const brokenDetailElements = filter$5(editor.dom.select('details'), hasNoSummary);
|
|
26126
|
-
each$e(brokenDetailElements, details => {
|
|
26127
|
-
if (isBr$6(details.firstChild)) {
|
|
26128
|
-
details.firstChild.remove();
|
|
26129
|
-
}
|
|
26130
|
-
const summary = editor.dom.create('summary');
|
|
26131
|
-
summary.appendChild(createPaddingBr().dom);
|
|
26132
|
-
details.prepend(summary);
|
|
26133
|
-
});
|
|
26134
|
-
}
|
|
26135
|
-
});
|
|
26136
|
-
};
|
|
26137
25793
|
const setup$a = (editor, draggingInternallyState) => {
|
|
26138
25794
|
if (shouldPasteBlockDrop(editor)) {
|
|
26139
25795
|
editor.on('dragend dragover draggesture dragdrop drop drag', e => {
|
|
@@ -26164,16 +25820,15 @@
|
|
|
26164
25820
|
}
|
|
26165
25821
|
const internalContent = dropContent[internalHtmlMime()];
|
|
26166
25822
|
const content = internalContent || dropContent['text/html'] || dropContent['text/plain'];
|
|
26167
|
-
const
|
|
26168
|
-
|
|
26169
|
-
if (isInternalDrop && !needsInternalDrop) {
|
|
25823
|
+
const transparentElementDrop = isTransparentBlockDrop(editor.dom, editor.schema, rng.startContainer, dropContent);
|
|
25824
|
+
if (draggingInternallyState.get() && !transparentElementDrop) {
|
|
26170
25825
|
return;
|
|
26171
25826
|
}
|
|
26172
25827
|
if (content) {
|
|
26173
25828
|
e.preventDefault();
|
|
26174
25829
|
Delay.setEditorTimeout(editor, () => {
|
|
26175
25830
|
editor.undoManager.transact(() => {
|
|
26176
|
-
if (internalContent
|
|
25831
|
+
if (internalContent) {
|
|
26177
25832
|
editor.execCommand('Delete');
|
|
26178
25833
|
}
|
|
26179
25834
|
setFocusedRange(editor, rng);
|
|
@@ -26199,7 +25854,6 @@
|
|
|
26199
25854
|
draggingInternallyState.set(false);
|
|
26200
25855
|
}
|
|
26201
25856
|
});
|
|
26202
|
-
setupSummaryDeleteByDragFix(editor);
|
|
26203
25857
|
};
|
|
26204
25858
|
|
|
26205
25859
|
const setup$9 = editor => {
|
|
@@ -26309,9 +25963,197 @@
|
|
|
26309
25963
|
});
|
|
26310
25964
|
});
|
|
26311
25965
|
};
|
|
25966
|
+
const emptyNodeContents = node => fillWithPaddingBr(SugarElement.fromDom(node));
|
|
25967
|
+
const setCaretToPosition = (editor, position) => {
|
|
25968
|
+
const node = position.getNode();
|
|
25969
|
+
if (!isUndefined(node)) {
|
|
25970
|
+
editor.selection.setCursorLocation(node, position.offset());
|
|
25971
|
+
}
|
|
25972
|
+
};
|
|
25973
|
+
const isEntireNodeSelected = (rng, node) => {
|
|
25974
|
+
var _a;
|
|
25975
|
+
return rng.startOffset === 0 && rng.endOffset === ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.length);
|
|
25976
|
+
};
|
|
25977
|
+
const platform = detect$2();
|
|
25978
|
+
const browser = platform.browser;
|
|
25979
|
+
const os = platform.os;
|
|
25980
|
+
const isSafari = browser.isSafari();
|
|
25981
|
+
const isMacOSOriOS = os.isMacOS() || os.isiOS();
|
|
25982
|
+
const isCaretInTheBeginningOf = (caretPos, element) => firstPositionIn(element).exists(pos => pos.isEqual(caretPos));
|
|
25983
|
+
const isCaretInTheEndOf = (caretPos, element) => {
|
|
25984
|
+
return lastPositionIn(element).exists(pos => {
|
|
25985
|
+
if (isBr$6(pos.getNode())) {
|
|
25986
|
+
return prevPosition(element, pos).exists(pos2 => pos2.isEqual(caretPos)) || pos.isEqual(caretPos);
|
|
25987
|
+
} else {
|
|
25988
|
+
return pos.isEqual(caretPos);
|
|
25989
|
+
}
|
|
25990
|
+
});
|
|
25991
|
+
};
|
|
25992
|
+
const getDetailsElements = (dom, rng) => {
|
|
25993
|
+
const startDetails = Optional.from(dom.getParent(rng.startContainer, 'details'));
|
|
25994
|
+
const endDetails = Optional.from(dom.getParent(rng.endContainer, 'details'));
|
|
25995
|
+
if (startDetails.isSome() || endDetails.isSome()) {
|
|
25996
|
+
const startSummary = startDetails.bind(details => Optional.from(dom.select('summary', details)[0]));
|
|
25997
|
+
return Optional.some({
|
|
25998
|
+
startSummary,
|
|
25999
|
+
startDetails,
|
|
26000
|
+
endDetails
|
|
26001
|
+
});
|
|
26002
|
+
} else {
|
|
26003
|
+
return Optional.none();
|
|
26004
|
+
}
|
|
26005
|
+
};
|
|
26006
|
+
const isPartialDelete = (rng, detailsElements) => {
|
|
26007
|
+
const containsStart = element => element.contains(rng.startContainer);
|
|
26008
|
+
const containsEnd = element => element.contains(rng.endContainer);
|
|
26009
|
+
const startInSummary = detailsElements.startSummary.exists(containsStart);
|
|
26010
|
+
const endInSummary = detailsElements.startSummary.exists(containsEnd);
|
|
26011
|
+
const isPartiallySelectedDetailsElements = detailsElements.startDetails.forall(startDetails => detailsElements.endDetails.forall(endDetails => startDetails !== endDetails));
|
|
26012
|
+
const isInPartiallySelectedSummary = (startInSummary || endInSummary) && !(startInSummary && endInSummary);
|
|
26013
|
+
return isInPartiallySelectedSummary || isPartiallySelectedDetailsElements;
|
|
26014
|
+
};
|
|
26015
|
+
const isCaretAtStartOfSummary = (caretPos, detailsElements) => detailsElements.startSummary.exists(summary => isCaretInTheBeginningOf(caretPos, summary));
|
|
26016
|
+
const isCaretAtEndOfSummary = (caretPos, detailsElements) => detailsElements.startSummary.exists(summary => isCaretInTheEndOf(caretPos, summary));
|
|
26017
|
+
const isCaretInFirstPositionInBody = (caretPos, detailsElements) => detailsElements.startDetails.exists(details => prevPosition(details, caretPos).forall(pos => detailsElements.startSummary.exists(summary => !summary.contains(caretPos.container()) && summary.contains(pos.container()))));
|
|
26018
|
+
const isCaretInLastPositionInBody = (root, caretPos, detailsElements) => detailsElements.startDetails.exists(details => nextPosition(root, caretPos).forall(pos => !details.contains(pos.container())));
|
|
26019
|
+
const isInDetailsElement = (dom, pos) => isNonNullable(dom.getParent(pos.container(), 'details'));
|
|
26020
|
+
const moveCaretToDetailsPos = (editor, pos) => {
|
|
26021
|
+
const details = editor.dom.getParent(pos.container(), 'details');
|
|
26022
|
+
if (details && !details.open) {
|
|
26023
|
+
const summary = editor.dom.select('summary', details)[0];
|
|
26024
|
+
if (summary) {
|
|
26025
|
+
lastPositionIn(summary).each(pos => setCaretToPosition(editor, pos));
|
|
26026
|
+
}
|
|
26027
|
+
} else {
|
|
26028
|
+
setCaretToPosition(editor, pos);
|
|
26029
|
+
}
|
|
26030
|
+
};
|
|
26031
|
+
const preventDeleteIntoDetails = (editor, forward) => {
|
|
26032
|
+
const {dom, selection} = editor;
|
|
26033
|
+
const root = editor.getBody();
|
|
26034
|
+
if (editor.selection.isCollapsed()) {
|
|
26035
|
+
const caretPos = CaretPosition.fromRangeStart(selection.getRng());
|
|
26036
|
+
const parentBlock = dom.getParent(caretPos.container(), dom.isBlock);
|
|
26037
|
+
if (parentBlock && dom.isEmpty(parentBlock)) {
|
|
26038
|
+
if (isNull(parentBlock.nextSibling)) {
|
|
26039
|
+
const pos = prevPosition(root, caretPos).filter(pos => isInDetailsElement(dom, pos));
|
|
26040
|
+
if (pos.isSome()) {
|
|
26041
|
+
pos.each(pos => {
|
|
26042
|
+
if (!forward) {
|
|
26043
|
+
moveCaretToDetailsPos(editor, pos);
|
|
26044
|
+
}
|
|
26045
|
+
});
|
|
26046
|
+
return true;
|
|
26047
|
+
}
|
|
26048
|
+
} else if (isNull(parentBlock.previousSibling)) {
|
|
26049
|
+
const pos = nextPosition(root, caretPos).filter(pos => isInDetailsElement(dom, pos));
|
|
26050
|
+
if (pos) {
|
|
26051
|
+
return true;
|
|
26052
|
+
}
|
|
26053
|
+
}
|
|
26054
|
+
}
|
|
26055
|
+
return navigate(forward, root, caretPos).fold(never, pos => {
|
|
26056
|
+
if (isInDetailsElement(dom, pos)) {
|
|
26057
|
+
if (parentBlock && dom.isEmpty(parentBlock)) {
|
|
26058
|
+
editor.dom.remove(parentBlock);
|
|
26059
|
+
}
|
|
26060
|
+
if (!forward) {
|
|
26061
|
+
moveCaretToDetailsPos(editor, pos);
|
|
26062
|
+
}
|
|
26063
|
+
return true;
|
|
26064
|
+
} else {
|
|
26065
|
+
return false;
|
|
26066
|
+
}
|
|
26067
|
+
});
|
|
26068
|
+
} else {
|
|
26069
|
+
return false;
|
|
26070
|
+
}
|
|
26071
|
+
};
|
|
26072
|
+
const preventDeleteSummaryAction = (editor, detailElements, e) => {
|
|
26073
|
+
const selection = editor.selection;
|
|
26074
|
+
const node = selection.getNode();
|
|
26075
|
+
const rng = selection.getRng();
|
|
26076
|
+
const isBackspace = e.keyCode === VK.BACKSPACE;
|
|
26077
|
+
const isDelete = e.keyCode === VK.DELETE;
|
|
26078
|
+
const isCollapsed = editor.selection.isCollapsed();
|
|
26079
|
+
const caretPos = CaretPosition.fromRangeStart(rng);
|
|
26080
|
+
const root = editor.getBody();
|
|
26081
|
+
if (!isCollapsed && isPartialDelete(rng, detailElements)) {
|
|
26082
|
+
return true;
|
|
26083
|
+
} else if (isCollapsed && isBackspace && isCaretAtStartOfSummary(caretPos, detailElements)) {
|
|
26084
|
+
return true;
|
|
26085
|
+
} else if (isCollapsed && isDelete && isCaretAtEndOfSummary(caretPos, detailElements)) {
|
|
26086
|
+
return true;
|
|
26087
|
+
} else if (isCollapsed && isBackspace && isCaretInFirstPositionInBody(caretPos, detailElements)) {
|
|
26088
|
+
return true;
|
|
26089
|
+
} else if (isCollapsed && isDelete && isCaretInLastPositionInBody(root, caretPos, detailElements)) {
|
|
26090
|
+
return true;
|
|
26091
|
+
} else if (isSafari && isSummary(node)) {
|
|
26092
|
+
if (!isCollapsed && isEntireNodeSelected(rng, node) || willDeleteLastPositionInElement(isDelete, caretPos, node)) {
|
|
26093
|
+
emptyNodeContents(node);
|
|
26094
|
+
} else {
|
|
26095
|
+
editor.undoManager.transact(() => {
|
|
26096
|
+
const sel = selection.getSel();
|
|
26097
|
+
let {anchorNode, anchorOffset, focusNode, focusOffset} = sel !== null && sel !== void 0 ? sel : {};
|
|
26098
|
+
const applySelection = () => {
|
|
26099
|
+
if (isNonNullable(anchorNode) && isNonNullable(anchorOffset) && isNonNullable(focusNode) && isNonNullable(focusOffset)) {
|
|
26100
|
+
sel === null || sel === void 0 ? void 0 : sel.setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset);
|
|
26101
|
+
}
|
|
26102
|
+
};
|
|
26103
|
+
const updateSelection = () => {
|
|
26104
|
+
anchorNode = sel === null || sel === void 0 ? void 0 : sel.anchorNode;
|
|
26105
|
+
anchorOffset = sel === null || sel === void 0 ? void 0 : sel.anchorOffset;
|
|
26106
|
+
focusNode = sel === null || sel === void 0 ? void 0 : sel.focusNode;
|
|
26107
|
+
focusOffset = sel === null || sel === void 0 ? void 0 : sel.focusOffset;
|
|
26108
|
+
};
|
|
26109
|
+
const appendAllChildNodes = (from, to) => {
|
|
26110
|
+
each$e(from.childNodes, child => {
|
|
26111
|
+
if (isNode(child)) {
|
|
26112
|
+
to.appendChild(child);
|
|
26113
|
+
}
|
|
26114
|
+
});
|
|
26115
|
+
};
|
|
26116
|
+
const container = editor.dom.create('span', { 'data-mce-bogus': 'all' });
|
|
26117
|
+
appendAllChildNodes(node, container);
|
|
26118
|
+
node.appendChild(container);
|
|
26119
|
+
applySelection();
|
|
26120
|
+
if (isCollapsed && (isMacOSOriOS && (e.altKey || isBackspace && e.metaKey) || !isMacOSOriOS && e.ctrlKey)) {
|
|
26121
|
+
sel === null || sel === void 0 ? void 0 : sel.modify('extend', isBackspace ? 'left' : 'right', e.metaKey ? 'line' : 'word');
|
|
26122
|
+
}
|
|
26123
|
+
if (!selection.isCollapsed() && isEntireNodeSelected(selection.getRng(), container)) {
|
|
26124
|
+
emptyNodeContents(node);
|
|
26125
|
+
} else {
|
|
26126
|
+
editor.execCommand(isBackspace ? 'Delete' : 'ForwardDelete');
|
|
26127
|
+
updateSelection();
|
|
26128
|
+
appendAllChildNodes(container, node);
|
|
26129
|
+
applySelection();
|
|
26130
|
+
}
|
|
26131
|
+
editor.dom.remove(container);
|
|
26132
|
+
});
|
|
26133
|
+
}
|
|
26134
|
+
return true;
|
|
26135
|
+
}
|
|
26136
|
+
return false;
|
|
26137
|
+
};
|
|
26138
|
+
const preventDeletingSummary = editor => {
|
|
26139
|
+
editor.on('keydown', e => {
|
|
26140
|
+
if (e.keyCode === VK.BACKSPACE || e.keyCode === VK.DELETE) {
|
|
26141
|
+
getDetailsElements(editor.dom, editor.selection.getRng()).fold(() => {
|
|
26142
|
+
if (preventDeleteIntoDetails(editor, e.keyCode === VK.DELETE)) {
|
|
26143
|
+
e.preventDefault();
|
|
26144
|
+
}
|
|
26145
|
+
}, detailsElements => {
|
|
26146
|
+
if (preventDeleteSummaryAction(editor, detailsElements, e)) {
|
|
26147
|
+
e.preventDefault();
|
|
26148
|
+
}
|
|
26149
|
+
});
|
|
26150
|
+
}
|
|
26151
|
+
});
|
|
26152
|
+
};
|
|
26312
26153
|
const setup$6 = editor => {
|
|
26313
26154
|
preventSummaryToggle(editor);
|
|
26314
26155
|
filterDetails(editor);
|
|
26156
|
+
preventDeletingSummary(editor);
|
|
26315
26157
|
};
|
|
26316
26158
|
|
|
26317
26159
|
const isBr = isBr$6;
|
|
@@ -27288,7 +27130,7 @@
|
|
|
27288
27130
|
const cleanEmptyNodes = (dom, node, isRoot) => {
|
|
27289
27131
|
if (node && dom.isEmpty(node) && !isRoot(node)) {
|
|
27290
27132
|
const parent = node.parentNode;
|
|
27291
|
-
dom.remove(node
|
|
27133
|
+
dom.remove(node);
|
|
27292
27134
|
cleanEmptyNodes(dom, parent, isRoot);
|
|
27293
27135
|
}
|
|
27294
27136
|
};
|
|
@@ -27780,17 +27622,12 @@
|
|
|
27780
27622
|
const allSelection = serializeRng(allRng);
|
|
27781
27623
|
return selection === allSelection;
|
|
27782
27624
|
};
|
|
27783
|
-
const hasPreservedEmptyElements = elm => {
|
|
27784
|
-
const scope = SugarElement.fromDom(elm);
|
|
27785
|
-
const isEditableHost = elm => parentElement(elm).exists(elm => !isEditable$3(elm));
|
|
27786
|
-
return exists(descendants(scope, '[contenteditable="true"]'), isEditableHost);
|
|
27787
|
-
};
|
|
27788
27625
|
editor.on('keydown', e => {
|
|
27789
27626
|
const keyCode = e.keyCode;
|
|
27790
27627
|
if (!isDefaultPrevented(e) && (keyCode === DELETE || keyCode === BACKSPACE) && editor.selection.isEditable()) {
|
|
27791
27628
|
const isCollapsed = editor.selection.isCollapsed();
|
|
27792
27629
|
const body = editor.getBody();
|
|
27793
|
-
if (isCollapsed &&
|
|
27630
|
+
if (isCollapsed && !dom.isEmpty(body)) {
|
|
27794
27631
|
return;
|
|
27795
27632
|
}
|
|
27796
27633
|
if (!isCollapsed && !allContentsSelected(editor.selection.getRng())) {
|
|
@@ -28415,19 +28252,6 @@
|
|
|
28415
28252
|
initEditor(editor);
|
|
28416
28253
|
}
|
|
28417
28254
|
};
|
|
28418
|
-
const startProgress = editor => {
|
|
28419
|
-
let canceled = false;
|
|
28420
|
-
const progressTimeout = setTimeout(() => {
|
|
28421
|
-
if (!canceled) {
|
|
28422
|
-
editor.setProgressState(true);
|
|
28423
|
-
}
|
|
28424
|
-
}, 500);
|
|
28425
|
-
return () => {
|
|
28426
|
-
clearTimeout(progressTimeout);
|
|
28427
|
-
canceled = true;
|
|
28428
|
-
editor.setProgressState(false);
|
|
28429
|
-
};
|
|
28430
|
-
};
|
|
28431
28255
|
const contentBodyLoaded = editor => {
|
|
28432
28256
|
const targetElm = editor.getElement();
|
|
28433
28257
|
let doc = editor.getDoc();
|
|
@@ -28488,11 +28312,7 @@
|
|
|
28488
28312
|
const setupRtcThunk = setup$s(editor);
|
|
28489
28313
|
preInit(editor);
|
|
28490
28314
|
setupRtcThunk.fold(() => {
|
|
28491
|
-
|
|
28492
|
-
loadContentCss(editor).then(() => {
|
|
28493
|
-
initEditorWithInitialContent(editor);
|
|
28494
|
-
cancelProgress();
|
|
28495
|
-
});
|
|
28315
|
+
loadContentCss(editor).then(() => initEditorWithInitialContent(editor));
|
|
28496
28316
|
}, setupRtc => {
|
|
28497
28317
|
editor.setProgressState(true);
|
|
28498
28318
|
loadContentCss(editor).then(() => {
|
|
@@ -29050,12 +28870,12 @@
|
|
|
29050
28870
|
JustifyFull: alignStates('alignjustify')
|
|
29051
28871
|
}, 'state');
|
|
29052
28872
|
};
|
|
29053
|
-
const registerCommands$
|
|
28873
|
+
const registerCommands$a = editor => {
|
|
29054
28874
|
registerExecCommands$3(editor);
|
|
29055
28875
|
registerQueryStateCommands$1(editor);
|
|
29056
28876
|
};
|
|
29057
28877
|
|
|
29058
|
-
const registerCommands$
|
|
28878
|
+
const registerCommands$9 = editor => {
|
|
29059
28879
|
editor.editorCommands.addCommands({
|
|
29060
28880
|
'Cut,Copy,Paste': command => {
|
|
29061
28881
|
const doc = editor.getDoc();
|
|
@@ -29139,7 +28959,7 @@
|
|
|
29139
28959
|
}
|
|
29140
28960
|
};
|
|
29141
28961
|
|
|
29142
|
-
const registerCommands$
|
|
28962
|
+
const registerCommands$8 = editor => {
|
|
29143
28963
|
editor.editorCommands.addCommands({
|
|
29144
28964
|
mceCleanup: () => {
|
|
29145
28965
|
const bm = editor.selection.getBookmark();
|
|
@@ -29317,12 +29137,12 @@
|
|
|
29317
29137
|
editor.editorCommands.addQueryValueHandler('FontSize', () => fontSizeQuery(editor));
|
|
29318
29138
|
editor.editorCommands.addQueryValueHandler('LineHeight', () => lineHeightQuery(editor));
|
|
29319
29139
|
};
|
|
29320
|
-
const registerCommands$
|
|
29140
|
+
const registerCommands$7 = editor => {
|
|
29321
29141
|
registerExecCommands$2(editor);
|
|
29322
29142
|
registerQueryValueCommands(editor);
|
|
29323
29143
|
};
|
|
29324
29144
|
|
|
29325
|
-
const registerCommands$
|
|
29145
|
+
const registerCommands$6 = editor => {
|
|
29326
29146
|
editor.editorCommands.addCommands({
|
|
29327
29147
|
mceAddUndoLevel: () => {
|
|
29328
29148
|
editor.undoManager.add();
|
|
@@ -29339,7 +29159,7 @@
|
|
|
29339
29159
|
});
|
|
29340
29160
|
};
|
|
29341
29161
|
|
|
29342
|
-
const registerCommands$
|
|
29162
|
+
const registerCommands$5 = editor => {
|
|
29343
29163
|
editor.editorCommands.addCommands({
|
|
29344
29164
|
Indent: () => {
|
|
29345
29165
|
indent(editor);
|
|
@@ -29351,7 +29171,7 @@
|
|
|
29351
29171
|
editor.editorCommands.addCommands({ Outdent: () => canOutdent(editor) }, 'state');
|
|
29352
29172
|
};
|
|
29353
29173
|
|
|
29354
|
-
const registerCommands$
|
|
29174
|
+
const registerCommands$4 = editor => {
|
|
29355
29175
|
const applyLinkToSelection = (_command, _ui, value) => {
|
|
29356
29176
|
const linkDetails = isString(value) ? { href: value } : value;
|
|
29357
29177
|
const anchor = editor.dom.getParent(editor.selection.getNode(), 'a');
|
|
@@ -29407,57 +29227,18 @@
|
|
|
29407
29227
|
}
|
|
29408
29228
|
}, 'state');
|
|
29409
29229
|
};
|
|
29410
|
-
const registerCommands$
|
|
29230
|
+
const registerCommands$3 = editor => {
|
|
29411
29231
|
registerExecCommands$1(editor);
|
|
29412
29232
|
registerQueryStateCommands(editor);
|
|
29413
29233
|
};
|
|
29414
29234
|
|
|
29415
|
-
const getTopParentBlock = (editor, node, root, container) => {
|
|
29416
|
-
const dom = editor.dom;
|
|
29417
|
-
const selector = node => dom.isBlock(node) && node.parentElement === root;
|
|
29418
|
-
const topParentBlock = selector(node) ? node : dom.getParent(container, selector, root);
|
|
29419
|
-
return Optional.from(topParentBlock).map(SugarElement.fromDom);
|
|
29420
|
-
};
|
|
29421
|
-
const insert = (editor, before) => {
|
|
29422
|
-
const dom = editor.dom;
|
|
29423
|
-
const rng = editor.selection.getRng();
|
|
29424
|
-
const node = before ? editor.selection.getStart() : editor.selection.getEnd();
|
|
29425
|
-
const container = before ? rng.startContainer : rng.endContainer;
|
|
29426
|
-
const root = getEditableRoot(dom, container);
|
|
29427
|
-
if (!root || !root.isContentEditable) {
|
|
29428
|
-
return;
|
|
29429
|
-
}
|
|
29430
|
-
const insertFn = before ? before$3 : after$4;
|
|
29431
|
-
const newBlockName = getForcedRootBlock(editor);
|
|
29432
|
-
getTopParentBlock(editor, node, root, container).each(parentBlock => {
|
|
29433
|
-
const newBlock = createNewBlock(editor, container, parentBlock.dom, root, false, newBlockName);
|
|
29434
|
-
insertFn(parentBlock, SugarElement.fromDom(newBlock));
|
|
29435
|
-
editor.selection.setCursorLocation(newBlock, 0);
|
|
29436
|
-
editor.dispatch('NewBlock', { newBlock });
|
|
29437
|
-
fireInputEvent(editor, 'insertParagraph');
|
|
29438
|
-
});
|
|
29439
|
-
};
|
|
29440
|
-
const insertBefore = editor => insert(editor, true);
|
|
29441
|
-
const insertAfter = editor => insert(editor, false);
|
|
29442
|
-
|
|
29443
|
-
const registerCommands$3 = editor => {
|
|
29444
|
-
editor.editorCommands.addCommands({
|
|
29445
|
-
InsertNewBlockBefore: () => {
|
|
29446
|
-
insertBefore(editor);
|
|
29447
|
-
},
|
|
29448
|
-
InsertNewBlockAfter: () => {
|
|
29449
|
-
insertAfter(editor);
|
|
29450
|
-
}
|
|
29451
|
-
});
|
|
29452
|
-
};
|
|
29453
|
-
|
|
29454
29235
|
const registerCommands$2 = editor => {
|
|
29455
29236
|
editor.editorCommands.addCommands({
|
|
29456
29237
|
insertParagraph: () => {
|
|
29457
29238
|
insertBreak(blockbreak, editor);
|
|
29458
29239
|
},
|
|
29459
29240
|
mceInsertNewLine: (_command, _ui, value) => {
|
|
29460
|
-
insert
|
|
29241
|
+
insert(editor, value);
|
|
29461
29242
|
},
|
|
29462
29243
|
InsertLineBreak: (_command, _ui, _value) => {
|
|
29463
29244
|
insertBreak(linebreak, editor);
|
|
@@ -29515,17 +29296,16 @@
|
|
|
29515
29296
|
});
|
|
29516
29297
|
};
|
|
29517
29298
|
const registerCommands = editor => {
|
|
29518
|
-
registerCommands$b(editor);
|
|
29519
29299
|
registerCommands$a(editor);
|
|
29520
|
-
registerCommands$7(editor);
|
|
29521
|
-
registerCommands$1(editor);
|
|
29522
29300
|
registerCommands$9(editor);
|
|
29523
|
-
registerCommands$5(editor);
|
|
29524
29301
|
registerCommands$6(editor);
|
|
29525
|
-
registerCommands$
|
|
29526
|
-
registerCommands$2(editor);
|
|
29527
|
-
registerCommands$4(editor);
|
|
29302
|
+
registerCommands$1(editor);
|
|
29528
29303
|
registerCommands$8(editor);
|
|
29304
|
+
registerCommands$4(editor);
|
|
29305
|
+
registerCommands$5(editor);
|
|
29306
|
+
registerCommands$2(editor);
|
|
29307
|
+
registerCommands$3(editor);
|
|
29308
|
+
registerCommands$7(editor);
|
|
29529
29309
|
registerExecCommands(editor);
|
|
29530
29310
|
};
|
|
29531
29311
|
|
|
@@ -30914,8 +30694,8 @@
|
|
|
30914
30694
|
documentBaseURL: null,
|
|
30915
30695
|
suffix: null,
|
|
30916
30696
|
majorVersion: '6',
|
|
30917
|
-
minorVersion: '
|
|
30918
|
-
releaseDate: '2023-08-
|
|
30697
|
+
minorVersion: '6.1',
|
|
30698
|
+
releaseDate: '2023-08-02',
|
|
30919
30699
|
i18n: I18n,
|
|
30920
30700
|
activeEditor: null,
|
|
30921
30701
|
focusedEditor: null,
|