@seafile/sdoc-editor 0.3.6 → 0.3.7
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/api/sdoc-server-api.js +165 -170
- package/dist/api/seafile-api.js +180 -246
- package/dist/basic-sdk/comment/comment-decorate.js +23 -30
- package/dist/basic-sdk/comment/components/comment-all-participants/index.js +18 -18
- package/dist/basic-sdk/comment/components/comment-all-participants/participant-avatar.js +13 -13
- package/dist/basic-sdk/comment/components/comment-delete-shadow.js +11 -9
- package/dist/basic-sdk/comment/components/comment-editor.js +37 -34
- package/dist/basic-sdk/comment/components/comment-input/comment-participant-item.js +16 -14
- package/dist/basic-sdk/comment/components/comment-input/index.js +110 -106
- package/dist/basic-sdk/comment/components/comment-item-content.js +29 -37
- package/dist/basic-sdk/comment/components/comment-item-reply.js +24 -33
- package/dist/basic-sdk/comment/components/comment-item-resolved-reply.js +5 -3
- package/dist/basic-sdk/comment/components/comment-item-wrapper.js +190 -285
- package/dist/basic-sdk/comment/components/comment-list.js +52 -72
- package/dist/basic-sdk/comment/components/comment-participants-editor/index.js +23 -30
- package/dist/basic-sdk/comment/components/comment-participants-editor/searched-collaborators.js +21 -19
- package/dist/basic-sdk/comment/components/comment-participants-editor/selected-participants.js +16 -14
- package/dist/basic-sdk/comment/components/editor-comment.js +23 -32
- package/dist/basic-sdk/comment/components/elements-comment-count/element-comment-count.js +18 -20
- package/dist/basic-sdk/comment/components/elements-comment-count/index.js +8 -8
- package/dist/basic-sdk/comment/components/global-comment/global-comment-body-header.js +23 -25
- package/dist/basic-sdk/comment/components/global-comment/global-comment-editor.js +9 -7
- package/dist/basic-sdk/comment/components/global-comment/global-comment-header.js +9 -6
- package/dist/basic-sdk/comment/components/global-comment/index.js +63 -86
- package/dist/basic-sdk/comment/constants/index.js +9 -9
- package/dist/basic-sdk/comment/helper.js +27 -26
- package/dist/basic-sdk/comment/hooks/comment-hooks/use-comment-context.js +8 -7
- package/dist/basic-sdk/comment/hooks/comment-hooks/use-comment-list.js +19 -30
- package/dist/basic-sdk/comment/hooks/comment-hooks/use-comment-mount.js +41 -71
- package/dist/basic-sdk/comment/hooks/notification-hooks/use-notification-context.js +8 -7
- package/dist/basic-sdk/comment/hooks/notification-hooks/use-notification-mount.js +45 -64
- package/dist/basic-sdk/comment/hooks/use-participants.js +46 -53
- package/dist/basic-sdk/comment/index.js +22 -19
- package/dist/basic-sdk/comment/provider/comment-context-provider.js +9 -11
- package/dist/basic-sdk/comment/provider/index.js +4 -2
- package/dist/basic-sdk/comment/provider/notification-context-provider.js +9 -11
- package/dist/basic-sdk/comment/reducer/comment-reducer.js +151 -137
- package/dist/basic-sdk/comment/reducer/notification-reducer.js +20 -15
- package/dist/basic-sdk/comment/utils/index.js +180 -173
- package/dist/basic-sdk/comment/utils/notification-utils.js +15 -14
- package/dist/basic-sdk/constants/index.js +9 -9
- package/dist/basic-sdk/cursor/helper.js +13 -9
- package/dist/basic-sdk/cursor/use-cursors.js +9 -13
- package/dist/basic-sdk/decorates/index.js +8 -9
- package/dist/basic-sdk/editor/editable-article.js +63 -57
- package/dist/basic-sdk/editor/sdoc-editor.js +42 -47
- package/dist/basic-sdk/extension/commons/color-menu/color-item.js +6 -4
- package/dist/basic-sdk/extension/commons/color-menu/index.js +40 -50
- package/dist/basic-sdk/extension/commons/dropdown-menu-item/index.js +17 -16
- package/dist/basic-sdk/extension/commons/element-popover/index.js +27 -45
- package/dist/basic-sdk/extension/commons/insert-element-dialog/index.js +46 -59
- package/dist/basic-sdk/extension/commons/menu/menu-group.js +7 -21
- package/dist/basic-sdk/extension/commons/menu/menu-item.js +17 -14
- package/dist/basic-sdk/extension/commons/more-dropdown/index.js +9 -7
- package/dist/basic-sdk/extension/commons/select-file-dialog/helpers.js +3 -3
- package/dist/basic-sdk/extension/commons/select-file-dialog/index.js +26 -23
- package/dist/basic-sdk/extension/commons/select-file-dialog/local-files/index.js +49 -80
- package/dist/basic-sdk/extension/constants/color.js +10 -10
- package/dist/basic-sdk/extension/constants/diff-view.js +3 -3
- package/dist/basic-sdk/extension/constants/element-type.js +29 -29
- package/dist/basic-sdk/extension/constants/font.js +44 -37
- package/dist/basic-sdk/extension/constants/index.js +27 -16
- package/dist/basic-sdk/extension/constants/keyboard.js +4 -4
- package/dist/basic-sdk/extension/constants/menus-config.js +234 -203
- package/dist/basic-sdk/extension/core/queries/index.js +185 -285
- package/dist/basic-sdk/extension/core/transforms/focus-editor.js +2 -2
- package/dist/basic-sdk/extension/core/transforms/move-children.js +14 -14
- package/dist/basic-sdk/extension/core/transforms/remove-node-children.js +6 -18
- package/dist/basic-sdk/extension/core/transforms/replace-node.js +22 -19
- package/dist/basic-sdk/extension/core/transforms/update-parent-node.js +6 -8
- package/dist/basic-sdk/extension/core/utils/index.js +12 -12
- package/dist/basic-sdk/extension/index.js +6 -6
- package/dist/basic-sdk/extension/plugins/blockquote/helpers.js +39 -54
- package/dist/basic-sdk/extension/plugins/blockquote/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/blockquote/menu/index.js +34 -44
- package/dist/basic-sdk/extension/plugins/blockquote/model.js +8 -9
- package/dist/basic-sdk/extension/plugins/blockquote/plugin.js +36 -37
- package/dist/basic-sdk/extension/plugins/blockquote/render-elem.js +7 -5
- package/dist/basic-sdk/extension/plugins/check-list/helpers.js +15 -25
- package/dist/basic-sdk/extension/plugins/check-list/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/check-list/menu/index.js +35 -45
- package/dist/basic-sdk/extension/plugins/check-list/model.js +9 -10
- package/dist/basic-sdk/extension/plugins/check-list/plugin.js +16 -10
- package/dist/basic-sdk/extension/plugins/check-list/render-elem.js +42 -56
- package/dist/basic-sdk/extension/plugins/clear-format/helpers.js +21 -36
- package/dist/basic-sdk/extension/plugins/clear-format/menu/index.js +12 -10
- package/dist/basic-sdk/extension/plugins/code-block/helpers.js +40 -58
- package/dist/basic-sdk/extension/plugins/code-block/hover-menu/index.js +38 -46
- package/dist/basic-sdk/extension/plugins/code-block/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/code-block/menu/index.js +9 -7
- package/dist/basic-sdk/extension/plugins/code-block/model.js +8 -9
- package/dist/basic-sdk/extension/plugins/code-block/plugin.js +44 -51
- package/dist/basic-sdk/extension/plugins/code-block/prismjs.js +27 -27
- package/dist/basic-sdk/extension/plugins/code-block/render-elem.js +62 -58
- package/dist/basic-sdk/extension/plugins/file-link/constants/index.js +16 -14
- package/dist/basic-sdk/extension/plugins/file-link/helpers.js +34 -36
- package/dist/basic-sdk/extension/plugins/file-link/hover-menu/index.js +19 -23
- package/dist/basic-sdk/extension/plugins/file-link/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/file-link/menu/index.js +10 -8
- package/dist/basic-sdk/extension/plugins/file-link/plugin.js +17 -11
- package/dist/basic-sdk/extension/plugins/file-link/render-elem.js +34 -38
- package/dist/basic-sdk/extension/plugins/font/helpers.js +75 -78
- package/dist/basic-sdk/extension/plugins/font/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/font/menu/font-family/font-item.js +14 -13
- package/dist/basic-sdk/extension/plugins/font/menu/font-family/index.js +38 -55
- package/dist/basic-sdk/extension/plugins/font/menu/font-size/font-size-scale.js +12 -10
- package/dist/basic-sdk/extension/plugins/font/menu/font-size/index.js +29 -31
- package/dist/basic-sdk/extension/plugins/font/menu/index.js +5 -3
- package/dist/basic-sdk/extension/plugins/font/plugin.js +4 -4
- package/dist/basic-sdk/extension/plugins/header/helpers.js +32 -38
- package/dist/basic-sdk/extension/plugins/header/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/header/menu/index.js +101 -107
- package/dist/basic-sdk/extension/plugins/header/plugin.js +41 -44
- package/dist/basic-sdk/extension/plugins/header/render-elem.js +28 -20
- package/dist/basic-sdk/extension/plugins/html/helper.js +30 -28
- package/dist/basic-sdk/extension/plugins/html/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/html/plugin.js +12 -10
- package/dist/basic-sdk/extension/plugins/html/rules/blockquote.js +5 -3
- package/dist/basic-sdk/extension/plugins/html/rules/check-list.js +4 -2
- package/dist/basic-sdk/extension/plugins/html/rules/code-block.js +20 -24
- package/dist/basic-sdk/extension/plugins/html/rules/header.js +7 -5
- package/dist/basic-sdk/extension/plugins/html/rules/image.js +4 -2
- package/dist/basic-sdk/extension/plugins/html/rules/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/html/rules/link.js +5 -3
- package/dist/basic-sdk/extension/plugins/html/rules/list.js +6 -4
- package/dist/basic-sdk/extension/plugins/html/rules/paragraph.js +5 -3
- package/dist/basic-sdk/extension/plugins/html/rules/table.js +5 -3
- package/dist/basic-sdk/extension/plugins/html/rules/text.js +5 -3
- package/dist/basic-sdk/extension/plugins/image/constants/index.js +2 -2
- package/dist/basic-sdk/extension/plugins/image/dialogs/image-previewer.js +59 -75
- package/dist/basic-sdk/extension/plugins/image/helpers.js +74 -98
- package/dist/basic-sdk/extension/plugins/image/hover-menu/index.js +49 -62
- package/dist/basic-sdk/extension/plugins/image/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/image/menu/index.js +12 -9
- package/dist/basic-sdk/extension/plugins/image/model.js +11 -12
- package/dist/basic-sdk/extension/plugins/image/plugin.js +43 -35
- package/dist/basic-sdk/extension/plugins/image/render-elem.js +73 -91
- package/dist/basic-sdk/extension/plugins/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/link/dialog/add-link-dialog/index.js +30 -39
- package/dist/basic-sdk/extension/plugins/link/helpers.js +76 -100
- package/dist/basic-sdk/extension/plugins/link/hover/index.js +12 -9
- package/dist/basic-sdk/extension/plugins/link/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/link/menu/index.js +10 -8
- package/dist/basic-sdk/extension/plugins/link/model.js +10 -11
- package/dist/basic-sdk/extension/plugins/link/plugin.js +28 -31
- package/dist/basic-sdk/extension/plugins/link/render-elem.js +66 -74
- package/dist/basic-sdk/extension/plugins/list/helpers.js +45 -57
- package/dist/basic-sdk/extension/plugins/list/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/list/menu/index.js +37 -49
- package/dist/basic-sdk/extension/plugins/list/model.js +11 -12
- package/dist/basic-sdk/extension/plugins/list/plugin/index.js +16 -12
- package/dist/basic-sdk/extension/plugins/list/plugin/insert-break-list.js +4 -4
- package/dist/basic-sdk/extension/plugins/list/plugin/insert-fragment-list.js +54 -70
- package/dist/basic-sdk/extension/plugins/list/plugin/normalize-list.js +16 -20
- package/dist/basic-sdk/extension/plugins/list/plugin/on-tab-handle.js +19 -14
- package/dist/basic-sdk/extension/plugins/list/plugin/shortcut.js +20 -28
- package/dist/basic-sdk/extension/plugins/list/queries/index.js +16 -18
- package/dist/basic-sdk/extension/plugins/list/render-elem.js +23 -15
- package/dist/basic-sdk/extension/plugins/list/transforms/insert-list-item.js +20 -24
- package/dist/basic-sdk/extension/plugins/list/transforms/move-list-item-down.js +16 -19
- package/dist/basic-sdk/extension/plugins/list/transforms/move-list-item-up.js +31 -35
- package/dist/basic-sdk/extension/plugins/list/transforms/move-list-items-to-list.js +18 -18
- package/dist/basic-sdk/extension/plugins/list/transforms/move-list-items.js +23 -24
- package/dist/basic-sdk/extension/plugins/list/transforms/normalize-list-item.js +38 -55
- package/dist/basic-sdk/extension/plugins/list/transforms/normalize-nested-list.js +11 -13
- package/dist/basic-sdk/extension/plugins/list/transforms/remove-first-list-item.js +8 -8
- package/dist/basic-sdk/extension/plugins/list/transforms/toggle-list.js +42 -50
- package/dist/basic-sdk/extension/plugins/list/transforms/unwrap-list.js +11 -14
- package/dist/basic-sdk/extension/plugins/markdown/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/markdown/plugin.js +59 -52
- package/dist/basic-sdk/extension/plugins/paragraph/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/paragraph/render-elem.js +12 -10
- package/dist/basic-sdk/extension/plugins/sdoc-link/constants/index.js +16 -14
- package/dist/basic-sdk/extension/plugins/sdoc-link/helpers.js +66 -65
- package/dist/basic-sdk/extension/plugins/sdoc-link/hover-menu/index.js +19 -23
- package/dist/basic-sdk/extension/plugins/sdoc-link/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/sdoc-link/menu/index.js +10 -8
- package/dist/basic-sdk/extension/plugins/sdoc-link/plugin.js +23 -15
- package/dist/basic-sdk/extension/plugins/sdoc-link/render-elem.js +35 -39
- package/dist/basic-sdk/extension/plugins/table/constants/index.js +16 -14
- package/dist/basic-sdk/extension/plugins/table/dialog/custom-table-size-dialog/index.js +17 -24
- package/dist/basic-sdk/extension/plugins/table/dialog/custom-table-size-dialog/number-input.js +9 -7
- package/dist/basic-sdk/extension/plugins/table/helpers.js +466 -440
- package/dist/basic-sdk/extension/plugins/table/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/cell-bg-color-menu.js +16 -13
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/cell-text-align-menu.js +16 -18
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/common-menu.js +58 -65
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/index.js +7 -5
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/remove-table-menu.js +11 -9
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/table-column-menu.js +13 -14
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/table-row-menu.js +13 -14
- package/dist/basic-sdk/extension/plugins/table/menu/table-context-menu/index.js +92 -105
- package/dist/basic-sdk/extension/plugins/table/menu/table-context-menu/insert-table-element.js +62 -66
- package/dist/basic-sdk/extension/plugins/table/menu/table-menu/index.js +9 -7
- package/dist/basic-sdk/extension/plugins/table/model.js +14 -15
- package/dist/basic-sdk/extension/plugins/table/plugin.js +130 -112
- package/dist/basic-sdk/extension/plugins/table/popover/table-size-popover/index.js +31 -45
- package/dist/basic-sdk/extension/plugins/table/popover/table-template/index.js +12 -14
- package/dist/basic-sdk/extension/plugins/table/popover/table-template/sample-table.js +15 -19
- package/dist/basic-sdk/extension/plugins/table/render/hooks.js +25 -32
- package/dist/basic-sdk/extension/plugins/table/render/index.js +57 -67
- package/dist/basic-sdk/extension/plugins/table/render/render-cell.js +42 -36
- package/dist/basic-sdk/extension/plugins/table/render/render-row.js +44 -49
- package/dist/basic-sdk/extension/plugins/table/render/resize-handlers/first-column-left-resize-handler.js +36 -45
- package/dist/basic-sdk/extension/plugins/table/render/resize-handlers/index.js +10 -8
- package/dist/basic-sdk/extension/plugins/table/render/resize-handlers/resize-handler.js +41 -50
- package/dist/basic-sdk/extension/plugins/table/render/table-header/columns-header/column-header.js +30 -29
- package/dist/basic-sdk/extension/plugins/table/render/table-header/columns-header/index.js +21 -33
- package/dist/basic-sdk/extension/plugins/table/render/table-header/index.js +17 -15
- package/dist/basic-sdk/extension/plugins/table/render/table-header/rows-columns-header.js +7 -5
- package/dist/basic-sdk/extension/plugins/table/render/table-header/rows-header/index.js +22 -32
- package/dist/basic-sdk/extension/plugins/table/render/table-header/rows-header/row-header.js +41 -43
- package/dist/basic-sdk/extension/plugins/table/render/table-root.js +16 -20
- package/dist/basic-sdk/extension/plugins/text-align/helpers.js +19 -24
- package/dist/basic-sdk/extension/plugins/text-align/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/text-align/menu/index.js +20 -26
- package/dist/basic-sdk/extension/plugins/text-style/caret.js +9 -7
- package/dist/basic-sdk/extension/plugins/text-style/helpers.js +17 -24
- package/dist/basic-sdk/extension/plugins/text-style/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/text-style/menu/index.js +38 -37
- package/dist/basic-sdk/extension/plugins/text-style/plugin.js +6 -6
- package/dist/basic-sdk/extension/plugins/text-style/render-elem.js +14 -10
- package/dist/basic-sdk/extension/render/custom-element.js +30 -49
- package/dist/basic-sdk/extension/render/element-decorate/rebase-decorate/index.js +6 -4
- package/dist/basic-sdk/extension/render/element-decorate/rebase-decorate/rebase-delete-modify-decorate.js +13 -10
- package/dist/basic-sdk/extension/render/element-decorate/rebase-decorate/rebase-modify-delete-decorate.js +13 -10
- package/dist/basic-sdk/extension/render/element-decorate/rebase-decorate/rebase-modify-modify-decorate.js +21 -19
- package/dist/basic-sdk/extension/render/render-element.js +5 -3
- package/dist/basic-sdk/extension/render/render-leaf.js +4 -6
- package/dist/basic-sdk/extension/toolbar/context-toolbar/index.js +18 -16
- package/dist/basic-sdk/extension/toolbar/header-toolbar/index.js +5 -3
- package/dist/basic-sdk/extension/toolbar/header-toolbar/insert-toolbar/index.js +29 -29
- package/dist/basic-sdk/extension/toolbar/header-toolbar/redo-undo.js +45 -53
- package/dist/basic-sdk/extension/toolbar/side-toolbar/event.js +8 -8
- package/dist/basic-sdk/extension/toolbar/side-toolbar/helpers.js +45 -49
- package/dist/basic-sdk/extension/toolbar/side-toolbar/index.js +50 -72
- package/dist/basic-sdk/extension/toolbar/side-toolbar/insert-below-menu.js +5 -3
- package/dist/basic-sdk/extension/toolbar/side-toolbar/insert-block-menu.js +25 -26
- package/dist/basic-sdk/extension/toolbar/side-toolbar/side-menu.js +24 -26
- package/dist/basic-sdk/extension/toolbar/side-toolbar/transform-menus.js +14 -16
- package/dist/basic-sdk/extension/utils/index.js +4 -4
- package/dist/basic-sdk/highlight/index.js +8 -13
- package/dist/basic-sdk/highlight/setNodeToDecorations.js +43 -73
- package/dist/basic-sdk/hooks/use-color-context.js +27 -35
- package/dist/basic-sdk/hooks/use-scroll-context.js +6 -4
- package/dist/basic-sdk/hooks/use-selection-element.js +5 -7
- package/dist/basic-sdk/hooks/use-selection-position.js +13 -15
- package/dist/basic-sdk/hooks/use-selection-update.js +6 -11
- package/dist/basic-sdk/layout/article-container.js +20 -23
- package/dist/basic-sdk/layout/editor-container.js +6 -4
- package/dist/basic-sdk/layout/editor-content.js +15 -15
- package/dist/basic-sdk/node-id/constants.js +9 -9
- package/dist/basic-sdk/node-id/helpers.js +44 -29
- package/dist/basic-sdk/node-id/index.js +13 -11
- package/dist/basic-sdk/outline/index.js +24 -27
- package/dist/basic-sdk/outline/outline-item.js +39 -44
- package/dist/basic-sdk/socket/helpers.js +99 -90
- package/dist/basic-sdk/socket/socket-client.js +175 -171
- package/dist/basic-sdk/socket/socket-manager.js +316 -297
- package/dist/basic-sdk/socket/with-socket-io.js +38 -30
- package/dist/basic-sdk/utils/debug.js +4 -4
- package/dist/basic-sdk/utils/diff-text.js +191 -193
- package/dist/basic-sdk/utils/diff.js +115 -106
- package/dist/basic-sdk/utils/document-utils.js +10 -13
- package/dist/basic-sdk/utils/dom-utils.js +18 -16
- package/dist/basic-sdk/utils/event-bus.js +26 -39
- package/dist/basic-sdk/utils/event-handler.js +81 -79
- package/dist/basic-sdk/utils/mouse-event.js +29 -27
- package/dist/basic-sdk/utils/object-utils.js +35 -53
- package/dist/basic-sdk/utils/rebase.js +101 -76
- package/dist/basic-sdk/views/published-revision-diff-viewer.js +19 -22
- package/dist/basic-sdk/views/readonly-article.js +7 -5
- package/dist/basic-sdk/views/revision-diff-viewer.js +15 -18
- package/dist/basic-sdk/views/sdoc-diff-viewer.js +8 -6
- package/dist/basic-sdk/views/sdoc-viewer.js +9 -7
- package/dist/components/common-loading/index.js +1 -1
- package/dist/components/doc-info/index.js +25 -23
- package/dist/components/doc-operations/collaborators-operation/collaborators-popover.js +36 -49
- package/dist/components/doc-operations/collaborators-operation/index.js +58 -76
- package/dist/components/doc-operations/comments-operation/index.js +7 -13
- package/dist/components/doc-operations/history-operation.js +5 -5
- package/dist/components/doc-operations/index.js +10 -9
- package/dist/components/doc-operations/more-operations.js +15 -21
- package/dist/components/doc-operations/revision-operations/changes-count/index.js +15 -16
- package/dist/components/doc-operations/revision-operations/index.js +65 -71
- package/dist/components/doc-operations/revision-operations/more-revision-operations/index.js +13 -17
- package/dist/components/doc-operations/revision-operations/publish-revision/index.js +8 -5
- package/dist/components/doc-operations/revision-operations/revisions/index.js +13 -19
- package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/index.js +56 -87
- package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/revision-operation/index.js +14 -16
- package/dist/components/doc-operations/revision-operations/view-changes/index.js +25 -32
- package/dist/components/doc-operations/share-operation/index.js +2 -2
- package/dist/components/doc-operations/tag-operation/constans.js +1 -1
- package/dist/components/doc-operations/tag-operation/file-tag-quick-view/index.js +26 -42
- package/dist/components/doc-operations/tag-operation/index.js +1 -1
- package/dist/components/doc-operations/tag-operation/tag-popover/index.js +95 -175
- package/dist/components/doc-operations/tag-operation/utils.js +2 -6
- package/dist/components/draft-dropdown/index.js +44 -53
- package/dist/components/loading/index.js +8 -22
- package/dist/components/modal-portal/index.js +15 -32
- package/dist/components/switch/index.js +8 -6
- package/dist/components/tip-dialog/index.js +21 -23
- package/dist/components/tip-message/index.js +93 -92
- package/dist/components/toast/alert.js +73 -88
- package/dist/components/toast/index.js +1 -1
- package/dist/components/toast/toast.js +76 -103
- package/dist/components/toast/toastManager.js +55 -89
- package/dist/components/toast/toaster.js +54 -56
- package/dist/components/tooltip/index.js +15 -16
- package/dist/constants/index.js +26 -6
- package/dist/constants/transfer-types.js +3 -3
- package/dist/context.js +242 -339
- package/dist/hooks/use-collaborators.js +18 -20
- package/dist/hooks/use-document.js +33 -45
- package/dist/layout/content.js +13 -26
- package/dist/layout/header.js +13 -26
- package/dist/layout/layout.js +11 -9
- package/dist/model/notification.js +10 -11
- package/dist/model/revision.js +27 -28
- package/dist/model/user.js +10 -11
- package/dist/pages/error-boundary.js +18 -36
- package/dist/pages/error-page.js +14 -26
- package/dist/pages/published-revision-viewer.js +23 -35
- package/dist/pages/simple-editor.js +39 -46
- package/dist/pages/simple-viewer.js +70 -104
- package/dist/utils/date-utils.js +67 -81
- package/dist/utils/get-event-transfer.js +13 -15
- package/dist/utils/hotkey.js +24 -24
- package/dist/utils/index.js +20 -20
- package/dist/utils/local-storage-utils.js +41 -58
- package/package.json +10 -10
- package/public/locales/cs/sdoc-editor.json +3 -1
- package/public/locales/de/sdoc-editor.json +3 -1
- package/public/locales/en/sdoc-editor.json +1 -0
- package/public/locales/es/sdoc-editor.json +3 -1
- package/public/locales/fr/sdoc-editor.json +3 -1
- package/public/locales/it/sdoc-editor.json +3 -1
- package/public/locales/ru/sdoc-editor.json +3 -1
- package/public/locales/zh_CN/sdoc-editor.json +1 -0
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
2
|
import slugid from 'slugid';
|
|
7
3
|
import { Editor, Range, Transforms, Point, Node } from '@seafile/slate';
|
|
8
4
|
import { ReactEditor } from '@seafile/slate-react';
|
|
@@ -13,38 +9,38 @@ import EventBus from '../../../utils/event-bus';
|
|
|
13
9
|
import { INTERNAL_EVENT, PAGE_EDIT_AREA_WIDTH } from '../../../constants';
|
|
14
10
|
import ObjectUtils from '../../../utils/object-utils';
|
|
15
11
|
import { replacePastedDataId } from '../../../node-id/helpers';
|
|
16
|
-
export
|
|
12
|
+
export const isTableMenuDisabled = (editor, readonly) => {
|
|
17
13
|
if (readonly) return true;
|
|
18
|
-
|
|
14
|
+
const {
|
|
15
|
+
selection
|
|
16
|
+
} = editor;
|
|
19
17
|
if (selection === null) return true;
|
|
20
18
|
if (!Range.isCollapsed(selection)) return true;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
_Editor$nodes2 = _slicedToArray(_Editor$nodes, 1),
|
|
43
|
-
match = _Editor$nodes2[0];
|
|
19
|
+
const [match] = Editor.nodes(editor, {
|
|
20
|
+
match: n => {
|
|
21
|
+
let type = getNodeType(n);
|
|
22
|
+
if (!type && isTextNode(n) && n.id) {
|
|
23
|
+
const parentNode = getParentNode(editor.children, n.id);
|
|
24
|
+
type = getNodeType(parentNode);
|
|
25
|
+
}
|
|
26
|
+
if (type.startsWith('header')) return true;
|
|
27
|
+
if (type === ELEMENT_TYPE.CODE_BLOCK) return true;
|
|
28
|
+
if (type === ELEMENT_TYPE.ORDERED_LIST) return true;
|
|
29
|
+
if (type === ELEMENT_TYPE.UNORDERED_LIST) return true;
|
|
30
|
+
if (type === ELEMENT_TYPE.BLOCKQUOTE) return true;
|
|
31
|
+
if (type === ELEMENT_TYPE.LIST_ITEM) return true;
|
|
32
|
+
if (type === ELEMENT_TYPE.TABLE) return true;
|
|
33
|
+
if (type === ELEMENT_TYPE.TABLE_CELL) return true;
|
|
34
|
+
if (type === ELEMENT_TYPE.TABLE_ROW) return true;
|
|
35
|
+
if (Editor.isVoid(editor, n)) return true;
|
|
36
|
+
return false;
|
|
37
|
+
},
|
|
38
|
+
universal: true
|
|
39
|
+
});
|
|
44
40
|
if (match) return true;
|
|
45
41
|
return false;
|
|
46
42
|
};
|
|
47
|
-
export
|
|
43
|
+
export const generateTableCell = () => {
|
|
48
44
|
return {
|
|
49
45
|
id: slugid.nice(),
|
|
50
46
|
type: ELEMENT_TYPE.TABLE_CELL,
|
|
@@ -54,17 +50,19 @@ export var generateTableCell = function generateTableCell() {
|
|
|
54
50
|
}]
|
|
55
51
|
};
|
|
56
52
|
};
|
|
57
|
-
export
|
|
58
|
-
|
|
59
|
-
for (
|
|
60
|
-
|
|
53
|
+
export const generateTableRow = colsCount => {
|
|
54
|
+
let children = [];
|
|
55
|
+
for (let i = 0; i < colsCount; i++) {
|
|
56
|
+
const tableCell = generateTableCell();
|
|
61
57
|
children.push(tableCell);
|
|
62
58
|
}
|
|
63
59
|
return {
|
|
64
60
|
id: slugid.nice(),
|
|
65
61
|
type: ELEMENT_TYPE.TABLE_ROW,
|
|
66
62
|
children: children,
|
|
67
|
-
style:
|
|
63
|
+
style: {
|
|
64
|
+
[TABLE_ROW_STYLE.MIN_HEIGHT]: TABLE_ROW_MIN_HEIGHT
|
|
65
|
+
}
|
|
68
66
|
};
|
|
69
67
|
};
|
|
70
68
|
|
|
@@ -75,22 +73,22 @@ export var generateTableRow = function generateTableRow(colsCount) {
|
|
|
75
73
|
* @param {Boolean} tableProps.alternate_highlight - is alternate highlight
|
|
76
74
|
* @param {string} tableProps.alternate_highlight_color - table alternate highlight color
|
|
77
75
|
*/
|
|
78
|
-
export
|
|
79
|
-
|
|
80
|
-
size =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
for (
|
|
88
|
-
|
|
76
|
+
export const generateEmptyTable = (editor, tableProps) => {
|
|
77
|
+
const {
|
|
78
|
+
size = [0, 0],
|
|
79
|
+
alternate_highlight = false,
|
|
80
|
+
alternate_highlight_color
|
|
81
|
+
} = tableProps;
|
|
82
|
+
const rowsCount = size[0];
|
|
83
|
+
const colsCount = size[1];
|
|
84
|
+
let children = [];
|
|
85
|
+
for (let i = 0; i < rowsCount; i++) {
|
|
86
|
+
const tableRow = generateTableRow(colsCount);
|
|
89
87
|
children.push(tableRow);
|
|
90
88
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
for (
|
|
89
|
+
const columnWidth = Math.max(TABLE_CELL_MIN_WIDTH, parseInt(editor.width / colsCount));
|
|
90
|
+
let columns = [];
|
|
91
|
+
for (let i = 0; i < colsCount; i++) {
|
|
94
92
|
columns.push({
|
|
95
93
|
width: columnWidth
|
|
96
94
|
});
|
|
@@ -99,24 +97,24 @@ export var generateEmptyTable = function generateEmptyTable(editor, tableProps)
|
|
|
99
97
|
id: slugid.nice(),
|
|
100
98
|
type: ELEMENT_TYPE.TABLE,
|
|
101
99
|
children: children,
|
|
102
|
-
columns
|
|
100
|
+
columns,
|
|
103
101
|
style: {
|
|
104
|
-
alternate_highlight
|
|
105
|
-
alternate_highlight_color
|
|
102
|
+
alternate_highlight,
|
|
103
|
+
alternate_highlight_color
|
|
106
104
|
}
|
|
107
105
|
};
|
|
108
106
|
};
|
|
109
|
-
export
|
|
110
|
-
|
|
107
|
+
export const insertTable = function (editor, size, selection) {
|
|
108
|
+
let position = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : INSERT_POSITION.CURRENT;
|
|
111
109
|
if (!size) return;
|
|
112
110
|
if (position !== INSERT_POSITION.AFTER) {
|
|
113
111
|
if (isTableMenuDisabled(editor)) return;
|
|
114
112
|
}
|
|
115
|
-
|
|
116
|
-
size
|
|
113
|
+
const tableNode = generateEmptyTable(editor, {
|
|
114
|
+
size
|
|
117
115
|
});
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
const validSelection = selection || editor.selection;
|
|
117
|
+
const path = Editor.path(editor, validSelection);
|
|
120
118
|
if (position === INSERT_POSITION.AFTER) {
|
|
121
119
|
Transforms.insertNodes(editor, tableNode, {
|
|
122
120
|
at: [path[0] + 1]
|
|
@@ -127,11 +125,11 @@ export var insertTable = function insertTable(editor, size, selection) {
|
|
|
127
125
|
at: [path[0]]
|
|
128
126
|
});
|
|
129
127
|
};
|
|
130
|
-
export
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
128
|
+
export const getSelectedInfo = editor => {
|
|
129
|
+
const currentTable = getSelectedNodeByType(editor, ELEMENT_TYPE.TABLE);
|
|
130
|
+
const currentRow = getSelectedNodeByType(editor, ELEMENT_TYPE.TABLE_ROW);
|
|
131
|
+
const currentCell = getSelectedNodeByType(editor, ELEMENT_TYPE.TABLE_CELL);
|
|
132
|
+
const currentCellPath = findPath(editor, currentCell);
|
|
135
133
|
return {
|
|
136
134
|
table: currentTable,
|
|
137
135
|
tablePath: findPath(editor, currentTable),
|
|
@@ -144,33 +142,27 @@ export var getSelectedInfo = function getSelectedInfo(editor) {
|
|
|
144
142
|
cellIndex: currentCellPath[currentCellPath.length - 1]
|
|
145
143
|
};
|
|
146
144
|
};
|
|
147
|
-
export
|
|
148
|
-
|
|
149
|
-
if (!selectedNodes.some(
|
|
150
|
-
|
|
151
|
-
})) return false;
|
|
152
|
-
var firstSelectedNode = selectedNodes[0];
|
|
145
|
+
export const isInTable = editor => {
|
|
146
|
+
const selectedNodes = getSelectedElems(editor);
|
|
147
|
+
if (!selectedNodes.some(node => node.type === ELEMENT_TYPE.TABLE)) return false;
|
|
148
|
+
const firstSelectedNode = selectedNodes[0];
|
|
153
149
|
return firstSelectedNode.type === ELEMENT_TYPE.TABLE;
|
|
154
150
|
};
|
|
155
|
-
export
|
|
156
|
-
|
|
157
|
-
if (!selectedNodes.some(
|
|
158
|
-
|
|
159
|
-
})) return false;
|
|
160
|
-
var firstSelectedNode = selectedNodes[0];
|
|
151
|
+
export const isAllInTable = editor => {
|
|
152
|
+
const selectedNodes = getSelectedElems(editor);
|
|
153
|
+
if (!selectedNodes.some(node => node.type === ELEMENT_TYPE.TABLE)) return false;
|
|
154
|
+
const firstSelectedNode = selectedNodes[0];
|
|
161
155
|
if (firstSelectedNode.type !== ELEMENT_TYPE.TABLE) return false;
|
|
162
|
-
return selectedNodes.slice(1).every(
|
|
163
|
-
return [ELEMENT_TYPE.TABLE_ROW, ELEMENT_TYPE.TABLE_CELL].includes(node.type);
|
|
164
|
-
}); // same table element
|
|
156
|
+
return selectedNodes.slice(1).every(node => [ELEMENT_TYPE.TABLE_ROW, ELEMENT_TYPE.TABLE_CELL].includes(node.type)); // same table element
|
|
165
157
|
};
|
|
166
158
|
|
|
167
|
-
export
|
|
159
|
+
export const setCellStyle = (editor, style) => {
|
|
168
160
|
if (ObjectUtils.isSameObject(editor.tableSelectedRange, EMPTY_SELECTED_RANGE)) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
selectedNodes.forEach(
|
|
161
|
+
const selectedNodes = getSelectedElems(editor);
|
|
162
|
+
let firstTableCellNodePath;
|
|
163
|
+
selectedNodes.forEach(node => {
|
|
172
164
|
if (node.type === ELEMENT_TYPE.TABLE_CELL) {
|
|
173
|
-
|
|
165
|
+
const path = findPath(editor, node);
|
|
174
166
|
if (path) {
|
|
175
167
|
firstTableCellNodePath = firstTableCellNodePath ? firstTableCellNodePath : path;
|
|
176
168
|
Transforms.setNodes(editor, {
|
|
@@ -182,9 +174,9 @@ export var setCellStyle = function setCellStyle(editor, style) {
|
|
|
182
174
|
}
|
|
183
175
|
});
|
|
184
176
|
if (firstTableCellNodePath) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
177
|
+
const start = Editor.start(editor, firstTableCellNodePath);
|
|
178
|
+
const end = Editor.end(editor, firstTableCellNodePath);
|
|
179
|
+
const newSelection = {
|
|
188
180
|
anchor: start,
|
|
189
181
|
focus: end
|
|
190
182
|
};
|
|
@@ -192,17 +184,19 @@ export var setCellStyle = function setCellStyle(editor, style) {
|
|
|
192
184
|
}
|
|
193
185
|
return;
|
|
194
186
|
}
|
|
195
|
-
|
|
196
|
-
minColIndex
|
|
197
|
-
maxColIndex
|
|
198
|
-
minRowIndex
|
|
199
|
-
maxRowIndex
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
187
|
+
const {
|
|
188
|
+
minColIndex,
|
|
189
|
+
maxColIndex,
|
|
190
|
+
minRowIndex,
|
|
191
|
+
maxRowIndex
|
|
192
|
+
} = editor.tableSelectedRange;
|
|
193
|
+
const {
|
|
194
|
+
tablePath
|
|
195
|
+
} = getSelectedInfo(editor);
|
|
196
|
+
for (let i = minRowIndex; i <= maxRowIndex; i++) {
|
|
197
|
+
for (let j = minColIndex; j <= maxColIndex; j++) {
|
|
198
|
+
const path = [...tablePath, i, j];
|
|
199
|
+
const node = getNode(editor, path);
|
|
206
200
|
Transforms.setNodes(editor, {
|
|
207
201
|
style: _objectSpread(_objectSpread({}, node.style), style)
|
|
208
202
|
}, {
|
|
@@ -211,89 +205,91 @@ export var setCellStyle = function setCellStyle(editor, style) {
|
|
|
211
205
|
}
|
|
212
206
|
}
|
|
213
207
|
};
|
|
214
|
-
export
|
|
215
|
-
|
|
216
|
-
|
|
208
|
+
export const insertTableRow = function (editor, table, rowIndex) {
|
|
209
|
+
let position = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : TABLE_ELEMENT_POSITION.AFTER;
|
|
210
|
+
const tableRowCount = table.children.length;
|
|
217
211
|
if (tableRowCount >= TABLE_MAX_ROWS) return;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
212
|
+
const tableColumnCount = table.children[0].children.length;
|
|
213
|
+
const row = generateTableRow(tableColumnCount);
|
|
214
|
+
const tablePath = findPath(editor, table);
|
|
215
|
+
const targetPath = position === TABLE_ELEMENT_POSITION.AFTER ? [...tablePath, rowIndex + 1] : [...tablePath, rowIndex];
|
|
222
216
|
Transforms.insertNodes(editor, row, {
|
|
223
217
|
at: targetPath
|
|
224
218
|
});
|
|
225
|
-
|
|
219
|
+
const focusPath = [...targetPath, 0];
|
|
226
220
|
focusEditor(editor, focusPath);
|
|
227
221
|
};
|
|
228
|
-
export
|
|
229
|
-
|
|
230
|
-
|
|
222
|
+
export const insertTableColumn = function (editor, table, columnIndex) {
|
|
223
|
+
let position = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : TABLE_ELEMENT_POSITION.AFTER;
|
|
224
|
+
const tableColumnCount = table.children[0].children.length;
|
|
231
225
|
if (tableColumnCount >= TABLE_MAX_COLUMNS) return;
|
|
232
|
-
|
|
233
|
-
|
|
226
|
+
const newCellIndex = position === TABLE_ELEMENT_POSITION.AFTER ? columnIndex + 1 : columnIndex;
|
|
227
|
+
const newColumns = getTableColumnsAfterInsertColumn(editor, table, newCellIndex, 1);
|
|
234
228
|
updateColumnWidth(editor, table, newColumns);
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
for (
|
|
238
|
-
|
|
239
|
-
|
|
229
|
+
const tablePath = findPath(editor, table);
|
|
230
|
+
const tableRowCount = table.children.length;
|
|
231
|
+
for (let i = 0; i < tableRowCount; i++) {
|
|
232
|
+
const newCellPath = [...tablePath, i, newCellIndex];
|
|
233
|
+
const newCell = generateTableCell();
|
|
240
234
|
Transforms.insertNodes(editor, newCell, {
|
|
241
235
|
at: newCellPath
|
|
242
236
|
});
|
|
243
237
|
}
|
|
244
|
-
|
|
238
|
+
const focusPath = [...tablePath, 0, newCellIndex, 0];
|
|
245
239
|
focusEditor(editor, focusPath);
|
|
246
240
|
};
|
|
247
|
-
export
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
table
|
|
252
|
-
tablePath
|
|
253
|
-
tableSize
|
|
254
|
-
rowIndex
|
|
255
|
-
cellIndex
|
|
256
|
-
|
|
241
|
+
export const insertTableElement = function (editor, type) {
|
|
242
|
+
let position = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : TABLE_ELEMENT_POSITION.AFTER;
|
|
243
|
+
let count = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
244
|
+
const {
|
|
245
|
+
table,
|
|
246
|
+
tablePath,
|
|
247
|
+
tableSize,
|
|
248
|
+
rowIndex,
|
|
249
|
+
cellIndex
|
|
250
|
+
} = getSelectedInfo(editor);
|
|
251
|
+
const eventBus = EventBus.getInstance();
|
|
257
252
|
eventBus.dispatch(INTERNAL_EVENT.CANCEL_TABLE_SELECT_RANGE);
|
|
258
253
|
if (type === TABLE_ELEMENT.ROW) {
|
|
259
254
|
if (tableSize[0] >= TABLE_MAX_ROWS) return;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
for (
|
|
263
|
-
|
|
255
|
+
const targetPath = position === TABLE_ELEMENT_POSITION.AFTER ? [...tablePath, rowIndex + 1] : [...tablePath, rowIndex];
|
|
256
|
+
const validCount = Math.min(TABLE_MAX_ROWS - tableSize[0], count);
|
|
257
|
+
for (let i = 0; i < validCount; i++) {
|
|
258
|
+
const row = generateTableRow(tableSize[1]);
|
|
264
259
|
Transforms.insertNodes(editor, row, {
|
|
265
260
|
at: targetPath
|
|
266
261
|
});
|
|
267
262
|
}
|
|
268
|
-
|
|
263
|
+
const focusPath = [...targetPath, cellIndex];
|
|
269
264
|
focusEditor(editor, focusPath);
|
|
270
265
|
return;
|
|
271
266
|
}
|
|
272
267
|
if (type === TABLE_ELEMENT.COLUMN) {
|
|
273
268
|
if (tableSize[1] >= TABLE_MAX_COLUMNS) return;
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
269
|
+
const newCellIndex = position === TABLE_ELEMENT_POSITION.AFTER ? cellIndex + 1 : cellIndex;
|
|
270
|
+
const validCount = Math.min(TABLE_MAX_COLUMNS - tableSize[1], count);
|
|
271
|
+
const newColumns = getTableColumnsAfterInsertColumn(editor, table, newCellIndex, validCount);
|
|
277
272
|
updateColumnWidth(editor, table, newColumns);
|
|
278
|
-
for (
|
|
279
|
-
for (
|
|
280
|
-
|
|
281
|
-
|
|
273
|
+
for (let j = 0; j < validCount; j++) {
|
|
274
|
+
for (let i = 0; i < tableSize[0]; i++) {
|
|
275
|
+
const newCellPath = [...tablePath, i, newCellIndex];
|
|
276
|
+
const newCell = generateTableCell();
|
|
282
277
|
Transforms.insertNodes(editor, newCell, {
|
|
283
278
|
at: newCellPath
|
|
284
279
|
});
|
|
285
280
|
}
|
|
286
281
|
}
|
|
287
|
-
|
|
288
|
-
focusEditor(editor,
|
|
282
|
+
const focusPath = [...tablePath, rowIndex, cellIndex + 1, 0];
|
|
283
|
+
focusEditor(editor, focusPath);
|
|
289
284
|
return;
|
|
290
285
|
}
|
|
291
286
|
};
|
|
292
|
-
export
|
|
293
|
-
|
|
287
|
+
export const removeTable = (editor, path) => {
|
|
288
|
+
let validPath = path;
|
|
294
289
|
if (!validPath) {
|
|
295
|
-
|
|
296
|
-
tablePath
|
|
290
|
+
const {
|
|
291
|
+
tablePath
|
|
292
|
+
} = getSelectedInfo(editor);
|
|
297
293
|
validPath = tablePath;
|
|
298
294
|
}
|
|
299
295
|
editor.reSetTableSelectedRange();
|
|
@@ -301,15 +297,16 @@ export var removeTable = function removeTable(editor, path) {
|
|
|
301
297
|
at: validPath
|
|
302
298
|
});
|
|
303
299
|
};
|
|
304
|
-
export
|
|
305
|
-
|
|
306
|
-
table
|
|
307
|
-
tablePath
|
|
308
|
-
tableSize
|
|
309
|
-
rowPath
|
|
310
|
-
rowIndex
|
|
311
|
-
cellIndex
|
|
312
|
-
|
|
300
|
+
export const removeTableElement = (editor, type) => {
|
|
301
|
+
const {
|
|
302
|
+
table,
|
|
303
|
+
tablePath,
|
|
304
|
+
tableSize,
|
|
305
|
+
rowPath,
|
|
306
|
+
rowIndex,
|
|
307
|
+
cellIndex
|
|
308
|
+
} = getSelectedInfo(editor);
|
|
309
|
+
const eventBus = EventBus.getInstance();
|
|
313
310
|
eventBus.dispatch(INTERNAL_EVENT.CANCEL_TABLE_SELECT_RANGE);
|
|
314
311
|
if (type === TABLE_ELEMENT.TABLE) {
|
|
315
312
|
removeTable(editor, tablePath);
|
|
@@ -321,27 +318,28 @@ export var removeTableElement = function removeTableElement(editor, type) {
|
|
|
321
318
|
return;
|
|
322
319
|
}
|
|
323
320
|
if (!ObjectUtils.isSameObject(editor.tableSelectedRange, EMPTY_SELECTED_RANGE)) {
|
|
324
|
-
|
|
325
|
-
minRowIndex
|
|
326
|
-
maxRowIndex
|
|
321
|
+
const {
|
|
322
|
+
minRowIndex,
|
|
323
|
+
maxRowIndex
|
|
324
|
+
} = editor.tableSelectedRange;
|
|
327
325
|
if (minRowIndex === 0 && maxRowIndex === tableSize[0] - 1) {
|
|
328
326
|
removeTable(editor, tablePath);
|
|
329
327
|
return;
|
|
330
328
|
}
|
|
331
|
-
for (
|
|
329
|
+
for (let i = minRowIndex; i <= maxRowIndex; i++) {
|
|
332
330
|
Transforms.removeNodes(editor, {
|
|
333
|
-
at: [
|
|
331
|
+
at: [...tablePath, minRowIndex]
|
|
334
332
|
});
|
|
335
333
|
}
|
|
336
|
-
|
|
337
|
-
focusEditor(editor,
|
|
334
|
+
const focusPath = [...tablePath, minRowIndex === 0 ? 0 : minRowIndex - 1, cellIndex];
|
|
335
|
+
focusEditor(editor, focusPath);
|
|
338
336
|
return;
|
|
339
337
|
}
|
|
340
338
|
Transforms.removeNodes(editor, {
|
|
341
339
|
at: rowPath
|
|
342
340
|
});
|
|
343
|
-
|
|
344
|
-
|
|
341
|
+
const focusRowIndex = rowIndex === tableSize[0] - 1 ? rowIndex - 1 : rowIndex;
|
|
342
|
+
const focusPath = [...tablePath, focusRowIndex, cellIndex];
|
|
345
343
|
focusEditor(editor, focusPath);
|
|
346
344
|
return;
|
|
347
345
|
}
|
|
@@ -351,89 +349,91 @@ export var removeTableElement = function removeTableElement(editor, type) {
|
|
|
351
349
|
return;
|
|
352
350
|
}
|
|
353
351
|
if (!ObjectUtils.isSameObject(editor.tableSelectedRange, EMPTY_SELECTED_RANGE)) {
|
|
354
|
-
|
|
355
|
-
minColIndex
|
|
356
|
-
maxColIndex
|
|
352
|
+
const {
|
|
353
|
+
minColIndex,
|
|
354
|
+
maxColIndex
|
|
355
|
+
} = editor.tableSelectedRange;
|
|
357
356
|
if (minColIndex === 0 && maxColIndex === tableSize[1] - 1) {
|
|
358
357
|
removeTable(editor, tablePath);
|
|
359
358
|
return;
|
|
360
359
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
updateColumnWidth(editor, table,
|
|
364
|
-
for (
|
|
365
|
-
for (
|
|
360
|
+
const columns = getTableColumns(editor, table);
|
|
361
|
+
const newColumns = [...columns.slice(0, minColIndex), ...columns.slice(maxColIndex + 1)];
|
|
362
|
+
updateColumnWidth(editor, table, newColumns);
|
|
363
|
+
for (let i = 0; i < tableSize[0]; i++) {
|
|
364
|
+
for (let j = minColIndex; j <= maxColIndex; j++) {
|
|
366
365
|
// count
|
|
367
|
-
|
|
366
|
+
const cellPath = [...tablePath, i, minColIndex];
|
|
368
367
|
Transforms.removeNodes(editor, {
|
|
369
368
|
at: cellPath
|
|
370
369
|
});
|
|
371
370
|
}
|
|
372
371
|
}
|
|
373
|
-
|
|
374
|
-
focusEditor(editor,
|
|
372
|
+
const focusPath = [...tablePath, rowIndex, minColIndex === 0 ? 0 : minColIndex - 1];
|
|
373
|
+
focusEditor(editor, focusPath);
|
|
375
374
|
return;
|
|
376
375
|
}
|
|
377
|
-
|
|
378
|
-
|
|
376
|
+
const columns = getTableColumns(editor, table);
|
|
377
|
+
const newColumns = columns.slice(0);
|
|
379
378
|
newColumns.splice(cellIndex, 1);
|
|
380
379
|
updateColumnWidth(editor, table, newColumns);
|
|
381
|
-
for (
|
|
382
|
-
|
|
380
|
+
for (let i = 0; i < tableSize[0]; i++) {
|
|
381
|
+
const cellPath = [...tablePath, i, cellIndex];
|
|
383
382
|
Transforms.removeNodes(editor, {
|
|
384
|
-
at:
|
|
383
|
+
at: cellPath
|
|
385
384
|
});
|
|
386
385
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
focusEditor(editor,
|
|
386
|
+
const focusCellIndex = cellIndex === tableSize[1] - 1 ? cellIndex - 1 : cellIndex;
|
|
387
|
+
const focusPath = [...tablePath, rowIndex, focusCellIndex];
|
|
388
|
+
focusEditor(editor, focusPath);
|
|
390
389
|
return;
|
|
391
390
|
}
|
|
392
391
|
};
|
|
393
|
-
export
|
|
392
|
+
export const setTableSelectedRange = (editor, range) => {
|
|
394
393
|
if (range) {
|
|
395
394
|
editor.tableSelectedRange = range;
|
|
396
395
|
return;
|
|
397
396
|
}
|
|
398
397
|
editor.tableSelectedRange = EMPTY_SELECTED_RANGE;
|
|
399
398
|
};
|
|
400
|
-
export
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
style =
|
|
399
|
+
export const updateTableRowHeight = (editor, element, rowHeight) => {
|
|
400
|
+
const path = findPath(editor, element);
|
|
401
|
+
const targetNode = getNode(editor, path);
|
|
402
|
+
const {
|
|
403
|
+
style = {}
|
|
404
|
+
} = targetNode;
|
|
405
405
|
if (style[TABLE_ROW_STYLE.MIN_HEIGHT] === rowHeight) return;
|
|
406
406
|
Transforms.setNodes(editor, {
|
|
407
|
-
style: _objectSpread(_objectSpread({}, style), {},
|
|
407
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
408
|
+
[TABLE_ROW_STYLE.MIN_HEIGHT]: rowHeight
|
|
409
|
+
})
|
|
408
410
|
}, {
|
|
409
411
|
at: path
|
|
410
412
|
});
|
|
411
413
|
};
|
|
412
|
-
export
|
|
413
|
-
|
|
414
|
+
export const updateColumnWidth = (editor, element, columns) => {
|
|
415
|
+
const path = findPath(editor, element);
|
|
414
416
|
Transforms.setNodes(editor, {
|
|
415
417
|
columns: columns
|
|
416
418
|
}, {
|
|
417
419
|
at: path
|
|
418
420
|
});
|
|
419
421
|
};
|
|
420
|
-
export
|
|
421
|
-
|
|
422
|
+
export const getTableColumnsWidth = function () {
|
|
423
|
+
let columns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
422
424
|
if (!Array.isArray(columns) || columns.length === 0) return 0;
|
|
423
|
-
return columns.reduce(
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
var targetColumn = columns[targetColumnIndex] || columns[targetColumnIndex - 1];
|
|
432
|
-
var targetInsertColumnsWidth = targetColumn.width * insertColumnCount;
|
|
425
|
+
return columns.reduce((pre, cur) => pre + cur.width, 0);
|
|
426
|
+
};
|
|
427
|
+
export const getTableColumnsAfterInsertColumn = (editor, element, targetColumnIndex, insertColumnCount) => {
|
|
428
|
+
const columns = getTableColumns(editor, element);
|
|
429
|
+
let newColumns = columns.slice(0);
|
|
430
|
+
let totalColumnsWidth = getTableColumnsWidth(columns);
|
|
431
|
+
const targetColumn = columns[targetColumnIndex] || columns[targetColumnIndex - 1];
|
|
432
|
+
const targetInsertColumnsWidth = targetColumn.width * insertColumnCount;
|
|
433
433
|
|
|
434
434
|
// Currently in scrolling state, insert directly
|
|
435
435
|
if (totalColumnsWidth > editor.width) {
|
|
436
|
-
for (
|
|
436
|
+
for (let i = 0; i < insertColumnCount; i++) {
|
|
437
437
|
newColumns.splice(targetColumnIndex, 0, targetColumn);
|
|
438
438
|
}
|
|
439
439
|
return newColumns;
|
|
@@ -442,61 +442,64 @@ export var getTableColumnsAfterInsertColumn = function getTableColumnsAfterInser
|
|
|
442
442
|
// Not currently scrolling
|
|
443
443
|
// It is not a scroll state after inserting a new column
|
|
444
444
|
if (totalColumnsWidth + targetInsertColumnsWidth < editor.width) {
|
|
445
|
-
for (
|
|
445
|
+
for (let i = 0; i < insertColumnCount; i++) {
|
|
446
446
|
newColumns.push(targetColumn);
|
|
447
447
|
}
|
|
448
448
|
return newColumns;
|
|
449
449
|
}
|
|
450
450
|
|
|
451
451
|
// After inserting a new column is a scrolling state
|
|
452
|
-
for (
|
|
452
|
+
for (let i = 0; i < insertColumnCount; i++) {
|
|
453
453
|
totalColumnsWidth += targetColumn.width;
|
|
454
454
|
newColumns.splice(targetColumnIndex, 0, targetColumn);
|
|
455
455
|
}
|
|
456
|
-
|
|
457
|
-
return newColumns.map(
|
|
456
|
+
const proportion = totalColumnsWidth / (editor.width - 1);
|
|
457
|
+
return newColumns.map(column => {
|
|
458
458
|
return _objectSpread(_objectSpread({}, column), {}, {
|
|
459
459
|
width: Math.max(parseInt(column.width / proportion), TABLE_CELL_MIN_WIDTH)
|
|
460
460
|
});
|
|
461
461
|
});
|
|
462
462
|
};
|
|
463
|
-
export
|
|
463
|
+
export const getTableColumns = (editor, element) => {
|
|
464
464
|
if (!element) return [];
|
|
465
|
-
|
|
465
|
+
let tableElement = element;
|
|
466
466
|
if (element.type === ELEMENT_TYPE.TABLE_CELL) {
|
|
467
|
-
|
|
468
|
-
|
|
467
|
+
const cellPath = findPath(editor, element);
|
|
468
|
+
const tablePath = cellPath.slice(0, -2);
|
|
469
469
|
tableElement = getNode(editor, tablePath);
|
|
470
470
|
}
|
|
471
|
-
|
|
472
|
-
columns
|
|
473
|
-
children
|
|
471
|
+
const {
|
|
472
|
+
columns,
|
|
473
|
+
children
|
|
474
|
+
} = tableElement;
|
|
474
475
|
if (columns) return columns;
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
for (
|
|
479
|
-
|
|
476
|
+
const columnsCount = children[0].children.length;
|
|
477
|
+
let initColumns = [];
|
|
478
|
+
const pageEditAreaWidth = editor.width || PAGE_EDIT_AREA_WIDTH;
|
|
479
|
+
for (let i = 0; i < columnsCount; i++) {
|
|
480
|
+
const column = {
|
|
480
481
|
width: Math.max(TABLE_CELL_MIN_WIDTH, parseInt(pageEditAreaWidth / columnsCount))
|
|
481
482
|
};
|
|
482
483
|
initColumns.push(column);
|
|
483
484
|
}
|
|
484
485
|
return initColumns;
|
|
485
486
|
};
|
|
486
|
-
export
|
|
487
|
-
|
|
487
|
+
export const getCellColumn = (editor, cellElement) => {
|
|
488
|
+
let column = {
|
|
488
489
|
width: TABLE_CELL_MIN_WIDTH
|
|
489
490
|
};
|
|
490
491
|
if (!editor || !cellElement) return column;
|
|
491
|
-
|
|
492
|
+
const cellPath = findPath(editor, cellElement);
|
|
492
493
|
if (!cellPath) return column;
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
494
|
+
const pathLength = cellPath.length;
|
|
495
|
+
const cellIndex = cellPath[pathLength - 1];
|
|
496
|
+
const tablePath = cellPath.slice(0, -2);
|
|
497
|
+
const tableElement = getNode(editor, tablePath);
|
|
498
|
+
const {
|
|
499
|
+
columns
|
|
500
|
+
} = tableElement;
|
|
501
|
+
const columnsCount = tableElement.children[0].children.length;
|
|
502
|
+
const pageEditAreaWidth = editor.width || PAGE_EDIT_AREA_WIDTH;
|
|
500
503
|
if (columns) {
|
|
501
504
|
column = columns[cellIndex];
|
|
502
505
|
}
|
|
@@ -504,17 +507,17 @@ export var getCellColumn = function getCellColumn(editor, cellElement) {
|
|
|
504
507
|
width: Math.max(TABLE_CELL_MIN_WIDTH, parseInt(pageEditAreaWidth / columnsCount))
|
|
505
508
|
};
|
|
506
509
|
};
|
|
507
|
-
export
|
|
508
|
-
|
|
510
|
+
export const getFirstTableCell = element => {
|
|
511
|
+
let tableCellElement = element;
|
|
509
512
|
while (tableCellElement && !(tableCellElement.hasAttribute('row-index') && tableCellElement.hasAttribute('cell-index'))) {
|
|
510
513
|
tableCellElement = tableCellElement.parentNode;
|
|
511
514
|
}
|
|
512
515
|
return tableCellElement;
|
|
513
516
|
};
|
|
514
|
-
export
|
|
517
|
+
export const elementHasImage = element => {
|
|
515
518
|
if (!element) return false;
|
|
516
519
|
if (!Array.isArray(element.children) || element.children.length === 0) return false;
|
|
517
|
-
return element.children.some(
|
|
520
|
+
return element.children.some(child => {
|
|
518
521
|
if (child.type === ELEMENT_TYPE.IMAGE) return true;
|
|
519
522
|
if (ObjectUtils.hasProperty(child, 'children')) {
|
|
520
523
|
return elementHasImage(child);
|
|
@@ -522,9 +525,10 @@ export var elementHasImage = function elementHasImage(element) {
|
|
|
522
525
|
return false;
|
|
523
526
|
});
|
|
524
527
|
};
|
|
525
|
-
export
|
|
526
|
-
|
|
527
|
-
tableSize
|
|
528
|
+
export const isSelectedAllCell = editor => {
|
|
529
|
+
const {
|
|
530
|
+
tableSize
|
|
531
|
+
} = getSelectedInfo(editor);
|
|
528
532
|
return ObjectUtils.isSameObject(editor.tableSelectedRange, {
|
|
529
533
|
minColIndex: 0,
|
|
530
534
|
maxColIndex: tableSize[1] - 1,
|
|
@@ -532,109 +536,118 @@ export var isSelectedAllCell = function isSelectedAllCell(editor) {
|
|
|
532
536
|
maxRowIndex: tableSize[0] - 1
|
|
533
537
|
});
|
|
534
538
|
};
|
|
535
|
-
export
|
|
536
|
-
|
|
537
|
-
table
|
|
538
|
-
tablePath
|
|
539
|
-
tableSize
|
|
540
|
-
rowIndex
|
|
541
|
-
cellIndex
|
|
542
|
-
|
|
539
|
+
export const insertMultipleRowsAndColumns = (editor, rows, columns) => {
|
|
540
|
+
const {
|
|
541
|
+
table,
|
|
542
|
+
tablePath,
|
|
543
|
+
tableSize,
|
|
544
|
+
rowIndex,
|
|
545
|
+
cellIndex
|
|
546
|
+
} = getSelectedInfo(editor);
|
|
547
|
+
const eventBus = EventBus.getInstance();
|
|
543
548
|
eventBus.dispatch(INTERNAL_EVENT.CANCEL_TABLE_SELECT_RANGE);
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
for (
|
|
549
|
-
|
|
550
|
-
|
|
549
|
+
const insertRows = rows.slice(tableSize[0] - rowIndex);
|
|
550
|
+
const insertColumns = columns.slice(tableSize[1] - cellIndex);
|
|
551
|
+
const validInsertRows = insertRows.slice(0, Math.min(TABLE_MAX_ROWS - tableSize[0], insertRows.length));
|
|
552
|
+
const validInsertColumns = insertColumns.slice(0, Math.min(TABLE_MAX_COLUMNS - tableSize[1], columns.length));
|
|
553
|
+
for (let i = 0; i < validInsertRows.length; i++) {
|
|
554
|
+
const insertRow = validInsertRows[i];
|
|
555
|
+
const row = generateTableRow(tableSize[1]);
|
|
551
556
|
row.style = insertRow.style;
|
|
552
557
|
Transforms.insertNodes(editor, row, {
|
|
553
|
-
at: [
|
|
558
|
+
at: [...tablePath, tableSize[0] + i]
|
|
554
559
|
});
|
|
555
560
|
}
|
|
556
561
|
if (validInsertColumns.length > 0) {
|
|
557
|
-
updateColumnWidth(editor, table, [
|
|
562
|
+
updateColumnWidth(editor, table, [...table.columns, ...validInsertColumns]);
|
|
558
563
|
}
|
|
559
|
-
for (
|
|
560
|
-
for (
|
|
561
|
-
|
|
562
|
-
|
|
564
|
+
for (let j = 0; j < validInsertColumns.length; j++) {
|
|
565
|
+
for (let i = 0; i < tableSize[0] + validInsertRows.length; i++) {
|
|
566
|
+
const newCellPath = [...tablePath, i, tableSize[1] - 1];
|
|
567
|
+
const newCell = generateTableCell();
|
|
563
568
|
Transforms.insertNodes(editor, newCell, {
|
|
564
569
|
at: newCellPath
|
|
565
570
|
});
|
|
566
571
|
}
|
|
567
572
|
}
|
|
568
|
-
for (
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
for (
|
|
572
|
-
|
|
573
|
-
|
|
573
|
+
for (let i = rowIndex; i < Math.min(TABLE_MAX_ROWS, rowIndex + rows.length); i++) {
|
|
574
|
+
const row = rows[i - rowIndex];
|
|
575
|
+
const cells = row.children;
|
|
576
|
+
for (let j = cellIndex; j < Math.min(TABLE_MAX_COLUMNS, cellIndex + columns.length); j++) {
|
|
577
|
+
const replaceCellIndex = j - cellIndex;
|
|
578
|
+
const replaceCell = cells[replaceCellIndex];
|
|
574
579
|
replaceNodeChildren(editor, {
|
|
575
|
-
at: [
|
|
580
|
+
at: [...tablePath, i, j],
|
|
576
581
|
nodes: replacePastedDataId(replaceCell.children)
|
|
577
582
|
});
|
|
578
583
|
}
|
|
579
584
|
}
|
|
580
|
-
focusEditor(editor, [
|
|
581
|
-
|
|
585
|
+
focusEditor(editor, [...tablePath, rowIndex, cellIndex, 0]);
|
|
586
|
+
const {
|
|
587
|
+
focus: newFocus
|
|
588
|
+
} = editor.selection;
|
|
582
589
|
Transforms.select(editor, {
|
|
583
590
|
focus: newFocus,
|
|
584
591
|
anchor: newFocus
|
|
585
592
|
});
|
|
586
593
|
return;
|
|
587
594
|
};
|
|
588
|
-
export
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
595
|
+
export const setTableFragmentData = (editor, dataTransfer) => {
|
|
596
|
+
const selectedNode = getSelectedNodeByType(editor, ELEMENT_TYPE.TABLE);
|
|
597
|
+
const fragment = editor.getFragment();
|
|
598
|
+
const string = JSON.stringify(fragment);
|
|
599
|
+
const encoded = window.btoa(encodeURIComponent(string));
|
|
593
600
|
dataTransfer.setData("application/".concat(CLIPBOARD_FORMAT_KEY), encoded);
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
minColIndex
|
|
597
|
-
maxColIndex
|
|
598
|
-
minRowIndex
|
|
599
|
-
maxRowIndex
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
601
|
+
const tableDom = document.createElement('table');
|
|
602
|
+
const {
|
|
603
|
+
minColIndex,
|
|
604
|
+
maxColIndex,
|
|
605
|
+
minRowIndex,
|
|
606
|
+
maxRowIndex
|
|
607
|
+
} = editor.tableSelectedRange;
|
|
608
|
+
const tablePath = findPath(editor, selectedNode);
|
|
609
|
+
for (let i = minRowIndex; i <= maxRowIndex; i++) {
|
|
610
|
+
const tr = document.createElement('tr');
|
|
611
|
+
for (let j = minColIndex; j <= maxColIndex; j++) {
|
|
612
|
+
const path = [...tablePath, i, j];
|
|
613
|
+
const node = getNode(editor, path);
|
|
614
|
+
const td = document.createElement('td');
|
|
615
|
+
const div = document.createElement('div');
|
|
616
|
+
div.innerHTML = ReactEditor.toDOMNode(editor, node).innerHTML;
|
|
617
|
+
td.appendChild(div);
|
|
610
618
|
tr.appendChild(td);
|
|
611
619
|
}
|
|
612
620
|
tableDom.appendChild(tr);
|
|
613
621
|
}
|
|
614
622
|
tableDom.setAttribute('data-slate-fragment', encoded);
|
|
615
|
-
|
|
623
|
+
const div = document.createElement('div');
|
|
616
624
|
div.appendChild(tableDom);
|
|
617
625
|
dataTransfer.setData('text/html', div.innerHTML);
|
|
618
626
|
dataTransfer.setData('text/plain', div.innerText);
|
|
619
627
|
return dataTransfer;
|
|
620
628
|
};
|
|
621
|
-
export
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
629
|
+
export const deleteTableRangeData = editor => {
|
|
630
|
+
const {
|
|
631
|
+
tableSelectedRange
|
|
632
|
+
} = editor;
|
|
633
|
+
const {
|
|
634
|
+
minRowIndex,
|
|
635
|
+
maxRowIndex,
|
|
636
|
+
minColIndex,
|
|
637
|
+
maxColIndex
|
|
638
|
+
} = tableSelectedRange;
|
|
639
|
+
const {
|
|
640
|
+
tablePath
|
|
641
|
+
} = getSelectedInfo(editor);
|
|
642
|
+
let forceCellPath;
|
|
643
|
+
for (let i = minRowIndex; i <= maxRowIndex; i++) {
|
|
644
|
+
for (let j = minColIndex; j <= maxColIndex; j++) {
|
|
645
|
+
const path = [...tablePath, i, j];
|
|
646
|
+
const node = getNode(editor, path);
|
|
634
647
|
if (!forceCellPath && (Node.string(node) || elementHasImage(node))) {
|
|
635
648
|
forceCellPath = path;
|
|
636
649
|
}
|
|
637
|
-
|
|
650
|
+
const firstNode = node.children[0];
|
|
638
651
|
replaceNodeChildren(editor, {
|
|
639
652
|
at: path,
|
|
640
653
|
nodes: _objectSpread(_objectSpread({}, firstNode), {}, {
|
|
@@ -645,116 +658,116 @@ export var deleteTableRangeData = function deleteTableRangeData(editor) {
|
|
|
645
658
|
}
|
|
646
659
|
if (forceCellPath) {
|
|
647
660
|
editor.tableSelectedRange = EMPTY_SELECTED_RANGE;
|
|
648
|
-
|
|
661
|
+
const eventBus = EventBus.getInstance();
|
|
649
662
|
eventBus.dispatch(INTERNAL_EVENT.CANCEL_TABLE_SELECT_RANGE);
|
|
650
663
|
focusEditor(editor, forceCellPath);
|
|
651
|
-
|
|
664
|
+
const {
|
|
665
|
+
focus: newFocus
|
|
666
|
+
} = editor.selection;
|
|
652
667
|
Transforms.select(editor, {
|
|
653
668
|
focus: newFocus,
|
|
654
669
|
anchor: newFocus
|
|
655
670
|
});
|
|
656
671
|
}
|
|
657
672
|
};
|
|
658
|
-
export
|
|
659
|
-
|
|
660
|
-
|
|
673
|
+
export const deleteHandler = editor => {
|
|
674
|
+
const {
|
|
675
|
+
selection,
|
|
676
|
+
tableSelectedRange
|
|
677
|
+
} = editor;
|
|
661
678
|
if (selection == null) return '';
|
|
662
679
|
if (!ObjectUtils.isSameObject(tableSelectedRange, EMPTY_SELECTED_RANGE)) {
|
|
663
680
|
if (isSelectedAllCell(editor)) return 'table';
|
|
664
681
|
return 'range';
|
|
665
682
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
}
|
|
673
|
-
return type === ELEMENT_TYPE.TABLE_CELL;
|
|
683
|
+
const [cellNodeEntry] = Editor.nodes(editor, {
|
|
684
|
+
match: n => {
|
|
685
|
+
let type = getNodeType(n);
|
|
686
|
+
if (!type && isTextNode(n) && n.id) {
|
|
687
|
+
const parentNode = getParentNode(editor.children, n.id);
|
|
688
|
+
type = getNodeType(parentNode);
|
|
674
689
|
}
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
690
|
+
return type === ELEMENT_TYPE.TABLE_CELL;
|
|
691
|
+
}
|
|
692
|
+
});
|
|
678
693
|
if (cellNodeEntry) {
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
var start = Editor.start(editor, cellPath);
|
|
694
|
+
const [, cellPath] = cellNodeEntry;
|
|
695
|
+
const start = Editor.start(editor, cellPath);
|
|
682
696
|
if (Point.equals(selection.anchor, start)) {
|
|
683
697
|
return 'default';
|
|
684
698
|
}
|
|
685
699
|
}
|
|
686
700
|
return '';
|
|
687
701
|
};
|
|
688
|
-
export
|
|
689
|
-
|
|
702
|
+
export const isTableLocation = (editor, location) => {
|
|
703
|
+
const tables = Editor.nodes(editor, {
|
|
690
704
|
at: location,
|
|
691
|
-
match:
|
|
692
|
-
|
|
705
|
+
match: n => {
|
|
706
|
+
let type = getNodeType(n);
|
|
693
707
|
if (!type && isTextNode(n) && n.id) {
|
|
694
|
-
|
|
708
|
+
const parentNode = getParentNode(editor.children, n.id);
|
|
695
709
|
type = getNodeType(parentNode);
|
|
696
710
|
}
|
|
697
711
|
return type === ELEMENT_TYPE.TABLE_CELL;
|
|
698
712
|
}
|
|
699
713
|
});
|
|
700
|
-
|
|
714
|
+
let hasTable = false;
|
|
701
715
|
// eslint-disable-next-line no-unused-vars
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
try {
|
|
705
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
706
|
-
var table = _step.value;
|
|
707
|
-
hasTable = true;
|
|
708
|
-
}
|
|
709
|
-
} catch (err) {
|
|
710
|
-
_iterator.e(err);
|
|
711
|
-
} finally {
|
|
712
|
-
_iterator.f();
|
|
716
|
+
for (const table of tables) {
|
|
717
|
+
hasTable = true;
|
|
713
718
|
}
|
|
714
719
|
return hasTable;
|
|
715
720
|
};
|
|
716
|
-
export
|
|
717
|
-
|
|
721
|
+
export const isCursorAtCellEnd = function (cell) {
|
|
722
|
+
let cursor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
718
723
|
if (!cell) return false;
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
724
|
+
const childrenCount = cell.children.length;
|
|
725
|
+
const lastChildren = cell.children[childrenCount - 1];
|
|
726
|
+
const textCount = lastChildren.text.length;
|
|
722
727
|
return cursor === textCount;
|
|
723
728
|
};
|
|
724
|
-
export
|
|
725
|
-
|
|
729
|
+
export const isCursorAtCellStart = function () {
|
|
730
|
+
let cursor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
726
731
|
return cursor === 0;
|
|
727
732
|
};
|
|
728
|
-
export
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
tableSize
|
|
732
|
-
tablePath
|
|
733
|
-
rowIndex
|
|
734
|
-
cellIndex
|
|
735
|
-
cell
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
733
|
+
export const focusCell = function (editor, event) {
|
|
734
|
+
let keyboardName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
735
|
+
const {
|
|
736
|
+
tableSize,
|
|
737
|
+
tablePath,
|
|
738
|
+
rowIndex,
|
|
739
|
+
cellIndex,
|
|
740
|
+
cell
|
|
741
|
+
} = getSelectedInfo(editor);
|
|
742
|
+
const tableParentPath = tablePath.slice(0, -1);
|
|
743
|
+
const tableIndex = tablePath[tablePath.length - 1];
|
|
744
|
+
const {
|
|
745
|
+
selection
|
|
746
|
+
} = editor;
|
|
747
|
+
const {
|
|
748
|
+
focus
|
|
749
|
+
} = selection;
|
|
740
750
|
if (keyboardName === KEYBOARD.UP) {
|
|
741
751
|
if (!isCursorAtCellStart(focus.offset)) {
|
|
742
|
-
setTimeout(
|
|
752
|
+
setTimeout(() => {
|
|
743
753
|
if (getSelectedNodeByType(editor, ELEMENT_TYPE.TABLE)) {
|
|
744
|
-
|
|
745
|
-
newCellIndex
|
|
754
|
+
const {
|
|
755
|
+
cellIndex: newCellIndex
|
|
756
|
+
} = getSelectedInfo(editor);
|
|
746
757
|
if (Math.abs(newCellIndex - cellIndex) !== 0) {
|
|
747
758
|
if (rowIndex === 0) {
|
|
748
759
|
if (tableIndex !== 0) {
|
|
749
|
-
focusEditor(editor, [
|
|
760
|
+
focusEditor(editor, [...tableParentPath, tableIndex - 1]);
|
|
750
761
|
}
|
|
751
762
|
return;
|
|
752
763
|
}
|
|
753
|
-
focusEditor(editor, [
|
|
754
|
-
|
|
764
|
+
focusEditor(editor, [...tableParentPath, tableIndex, rowIndex - 1, cellIndex]);
|
|
765
|
+
const {
|
|
766
|
+
focus: newFocus
|
|
767
|
+
} = editor.selection;
|
|
755
768
|
Transforms.select(editor, {
|
|
756
|
-
focus:
|
|
757
|
-
anchor:
|
|
769
|
+
focus: newFocus,
|
|
770
|
+
anchor: newFocus
|
|
758
771
|
});
|
|
759
772
|
}
|
|
760
773
|
}
|
|
@@ -764,12 +777,14 @@ export var focusCell = function focusCell(editor, event) {
|
|
|
764
777
|
event.preventDefault();
|
|
765
778
|
if (rowIndex === 0) {
|
|
766
779
|
if (tableIndex !== 0) {
|
|
767
|
-
focusEditor(editor, [
|
|
780
|
+
focusEditor(editor, [...tableParentPath, tableIndex - 1]);
|
|
768
781
|
}
|
|
769
782
|
return;
|
|
770
783
|
}
|
|
771
|
-
focusEditor(editor, [
|
|
772
|
-
|
|
784
|
+
focusEditor(editor, [...tableParentPath, tableIndex, rowIndex - 1, cellIndex]);
|
|
785
|
+
const {
|
|
786
|
+
focus: newFocus
|
|
787
|
+
} = editor.selection;
|
|
773
788
|
Transforms.select(editor, {
|
|
774
789
|
focus: newFocus,
|
|
775
790
|
anchor: newFocus
|
|
@@ -779,15 +794,17 @@ export var focusCell = function focusCell(editor, event) {
|
|
|
779
794
|
if (!isCursorAtCellEnd(cell, focus.offset)) return;
|
|
780
795
|
event.preventDefault();
|
|
781
796
|
if (rowIndex === tableSize[0] - 1 && cellIndex === tableSize[1] - 1) {
|
|
782
|
-
focusEditor(editor, [
|
|
797
|
+
focusEditor(editor, [...tableParentPath, tableIndex + 1]);
|
|
783
798
|
return;
|
|
784
799
|
}
|
|
785
800
|
if (cellIndex === tableSize[1] - 1) {
|
|
786
|
-
focusEditor(editor, [
|
|
801
|
+
focusEditor(editor, [...tableParentPath, tableIndex, rowIndex + 1, 0]);
|
|
787
802
|
} else {
|
|
788
|
-
focusEditor(editor, [
|
|
803
|
+
focusEditor(editor, [...tableParentPath, tableIndex, rowIndex, cellIndex + 1]);
|
|
789
804
|
}
|
|
790
|
-
|
|
805
|
+
const {
|
|
806
|
+
anchor: newAnchor
|
|
807
|
+
} = editor.selection;
|
|
791
808
|
Transforms.select(editor, {
|
|
792
809
|
focus: newAnchor,
|
|
793
810
|
anchor: newAnchor
|
|
@@ -795,22 +812,25 @@ export var focusCell = function focusCell(editor, event) {
|
|
|
795
812
|
}
|
|
796
813
|
if (keyboardName === KEYBOARD.DOWN) {
|
|
797
814
|
if (!isCursorAtCellEnd(cell, focus.offset)) {
|
|
798
|
-
setTimeout(
|
|
815
|
+
setTimeout(() => {
|
|
799
816
|
if (getSelectedNodeByType(editor, ELEMENT_TYPE.TABLE)) {
|
|
800
|
-
|
|
801
|
-
newCellIndex
|
|
817
|
+
const {
|
|
818
|
+
cellIndex: newCellIndex
|
|
819
|
+
} = getSelectedInfo(editor);
|
|
802
820
|
if (Math.abs(newCellIndex - cellIndex) !== 0) {
|
|
803
821
|
if (rowIndex === tableSize[0] - 1) {
|
|
804
|
-
|
|
822
|
+
const nextNode = getNode(editor, [...tableParentPath, tableIndex + 1]);
|
|
805
823
|
if (!nextNode) return;
|
|
806
|
-
focusEditor(editor, [
|
|
824
|
+
focusEditor(editor, [...tableParentPath, tableIndex + 1]);
|
|
807
825
|
return;
|
|
808
826
|
}
|
|
809
|
-
focusEditor(editor, [
|
|
810
|
-
|
|
827
|
+
focusEditor(editor, [...tableParentPath, tableIndex, rowIndex + 1, cellIndex]);
|
|
828
|
+
const {
|
|
829
|
+
anchor: newAnchor
|
|
830
|
+
} = editor.selection;
|
|
811
831
|
Transforms.select(editor, {
|
|
812
|
-
focus:
|
|
813
|
-
anchor:
|
|
832
|
+
focus: newAnchor,
|
|
833
|
+
anchor: newAnchor
|
|
814
834
|
});
|
|
815
835
|
}
|
|
816
836
|
}
|
|
@@ -819,16 +839,18 @@ export var focusCell = function focusCell(editor, event) {
|
|
|
819
839
|
}
|
|
820
840
|
event.preventDefault();
|
|
821
841
|
if (rowIndex === tableSize[0] - 1) {
|
|
822
|
-
|
|
842
|
+
const nextNode = getNode([...tableParentPath, tableIndex + 1]);
|
|
823
843
|
if (!nextNode) return;
|
|
824
|
-
focusEditor(editor, [
|
|
844
|
+
focusEditor(editor, [...tableParentPath, tableIndex + 1]);
|
|
825
845
|
return;
|
|
826
846
|
}
|
|
827
|
-
focusEditor(editor, [
|
|
828
|
-
|
|
847
|
+
focusEditor(editor, [...tableParentPath, tableIndex, rowIndex + 1, cellIndex]);
|
|
848
|
+
const {
|
|
849
|
+
anchor: newAnchor
|
|
850
|
+
} = editor.selection;
|
|
829
851
|
Transforms.select(editor, {
|
|
830
|
-
focus:
|
|
831
|
-
anchor:
|
|
852
|
+
focus: newAnchor,
|
|
853
|
+
anchor: newAnchor
|
|
832
854
|
});
|
|
833
855
|
}
|
|
834
856
|
if (keyboardName === KEYBOARD.LEFT) {
|
|
@@ -836,69 +858,73 @@ export var focusCell = function focusCell(editor, event) {
|
|
|
836
858
|
event.preventDefault();
|
|
837
859
|
if (rowIndex === 0 && cellIndex === 0) {
|
|
838
860
|
if (tableIndex !== 0) {
|
|
839
|
-
focusEditor(editor, [
|
|
861
|
+
focusEditor(editor, [...tableParentPath, tableIndex - 1]);
|
|
840
862
|
}
|
|
841
863
|
return;
|
|
842
864
|
}
|
|
843
865
|
if (cellIndex === 0) {
|
|
844
|
-
focusEditor(editor, [
|
|
866
|
+
focusEditor(editor, [...tableParentPath, tableIndex, rowIndex - 1, tableSize[1] - 1]);
|
|
845
867
|
} else {
|
|
846
|
-
focusEditor(editor, [
|
|
868
|
+
focusEditor(editor, [...tableParentPath, tableIndex, rowIndex, cellIndex - 1]);
|
|
847
869
|
}
|
|
848
|
-
|
|
870
|
+
const {
|
|
871
|
+
focus: newFocus
|
|
872
|
+
} = editor.selection;
|
|
849
873
|
Transforms.select(editor, {
|
|
850
|
-
focus:
|
|
851
|
-
anchor:
|
|
874
|
+
focus: newFocus,
|
|
875
|
+
anchor: newFocus
|
|
852
876
|
});
|
|
853
877
|
}
|
|
854
878
|
};
|
|
855
|
-
export
|
|
879
|
+
export const isLastTableCell = (editor, cellNode) => {
|
|
856
880
|
if (cellNode[0].type !== ELEMENT_TYPE.TABLE_CELL) return false;
|
|
857
|
-
|
|
858
|
-
tableSize
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
881
|
+
const {
|
|
882
|
+
tableSize
|
|
883
|
+
} = getSelectedInfo(editor);
|
|
884
|
+
const lastRowIndex = tableSize[0] - 1;
|
|
885
|
+
const lastColumnIndex = tableSize[1] - 1;
|
|
886
|
+
const cellNodePath = cellNode[1];
|
|
887
|
+
const cellNodePathDeep = cellNodePath.length;
|
|
863
888
|
return cellNodePath[cellNodePathDeep - 1] === lastColumnIndex && cellNodePath[cellNodePathDeep - 2] === lastRowIndex;
|
|
864
889
|
};
|
|
865
|
-
|
|
890
|
+
const getValidColor = color => {
|
|
866
891
|
if (!color) return '';
|
|
867
|
-
|
|
892
|
+
const validColor = color.length === 4 ? '#' + color.slice(1, 4).repeat(2) : color;
|
|
868
893
|
return validColor.toUpperCase();
|
|
869
894
|
};
|
|
870
|
-
export
|
|
871
|
-
|
|
872
|
-
|
|
895
|
+
export const colorBlend = (c1, c2, ratio) => {
|
|
896
|
+
const color1 = getValidColor(c1);
|
|
897
|
+
const color2 = getValidColor(c2);
|
|
873
898
|
if (!color1 && !color2) return 'unset';
|
|
874
899
|
if (color1 && !color2) return color1;
|
|
875
900
|
if (!color1 && color2) return color2;
|
|
876
901
|
if (color1 === '#FFFFFF') return color2;
|
|
877
902
|
if (color2 === '#FFFFFF') return color1;
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
903
|
+
const validRatio = Math.max(Math.min(Number(ratio), 1), 0);
|
|
904
|
+
let r1 = parseInt(color1.substring(1, 3), 16);
|
|
905
|
+
let g1 = parseInt(color1.substring(3, 5), 16);
|
|
906
|
+
let b1 = parseInt(color1.substring(5, 7), 16);
|
|
907
|
+
let r2 = parseInt(color2.substring(1, 3), 16);
|
|
908
|
+
let g2 = parseInt(color2.substring(3, 5), 16);
|
|
909
|
+
let b2 = parseInt(color2.substring(5, 7), 16);
|
|
910
|
+
let r = Math.round(r1 * (1 - validRatio) + r2 * validRatio);
|
|
911
|
+
let g = Math.round(g1 * (1 - validRatio) + g2 * validRatio);
|
|
912
|
+
let b = Math.round(b1 * (1 - validRatio) + b2 * validRatio);
|
|
888
913
|
r = ('0' + (r || 0).toString(16)).slice(-2);
|
|
889
914
|
g = ('0' + (g || 0).toString(16)).slice(-2);
|
|
890
915
|
b = ('0' + (b || 0).toString(16)).slice(-2);
|
|
891
916
|
return '#' + r + g + b;
|
|
892
917
|
};
|
|
893
|
-
export
|
|
894
|
-
|
|
895
|
-
style =
|
|
896
|
-
|
|
918
|
+
export const getRowHeight = (element, rowIndex) => {
|
|
919
|
+
const {
|
|
920
|
+
style = {}
|
|
921
|
+
} = element;
|
|
922
|
+
const rowHeight = style[TABLE_ROW_STYLE.MIN_HEIGHT] || TABLE_ROW_MIN_HEIGHT;
|
|
897
923
|
return rowIndex === 0 ? rowHeight + 1 : rowHeight;
|
|
898
924
|
};
|
|
899
|
-
|
|
925
|
+
const normalizeTableCell = cell => {
|
|
900
926
|
if (!cell) return generateTableCell();
|
|
901
|
-
|
|
927
|
+
let newCell = _objectSpread({
|
|
902
928
|
children: [{
|
|
903
929
|
text: '',
|
|
904
930
|
id: slugid.nice()
|
|
@@ -906,16 +932,16 @@ var normalizeTableCell = function normalizeTableCell(cell) {
|
|
|
906
932
|
}, cell);
|
|
907
933
|
|
|
908
934
|
// normalize cell children
|
|
909
|
-
|
|
910
|
-
newCell.children.forEach(
|
|
911
|
-
|
|
935
|
+
let newCellChildren = [];
|
|
936
|
+
newCell.children.forEach(cellChild => {
|
|
937
|
+
const cellChildType = cellChild.type;
|
|
912
938
|
if (cellChildType === ELEMENT_TYPE.PARAGRAPH) {
|
|
913
|
-
newCellChildren.push
|
|
939
|
+
newCellChildren.push(...cellChild.children);
|
|
914
940
|
} else {
|
|
915
941
|
newCellChildren.push(cellChild);
|
|
916
942
|
}
|
|
917
943
|
});
|
|
918
|
-
newCell.children = newCellChildren.map(
|
|
944
|
+
newCell.children = newCellChildren.map(item => {
|
|
919
945
|
if (item.BOLD) {
|
|
920
946
|
item.bold = item.BOLD;
|
|
921
947
|
delete item['BOLD'];
|
|
@@ -929,9 +955,9 @@ var normalizeTableCell = function normalizeTableCell(cell) {
|
|
|
929
955
|
|
|
930
956
|
// normalize cell style
|
|
931
957
|
if (newCell.data) {
|
|
932
|
-
|
|
958
|
+
const cellStyle = _objectSpread({}, newCell.data);
|
|
933
959
|
delete newCell['data'];
|
|
934
|
-
Object.keys(cellStyle).forEach(
|
|
960
|
+
Object.keys(cellStyle).forEach(cellStyleKey => {
|
|
935
961
|
if (cellStyleKey === 'align') {
|
|
936
962
|
cellStyle['text_align'] = cellStyle['align'];
|
|
937
963
|
delete cellStyle['align'];
|
|
@@ -941,31 +967,31 @@ var normalizeTableCell = function normalizeTableCell(cell) {
|
|
|
941
967
|
}
|
|
942
968
|
return newCell;
|
|
943
969
|
};
|
|
944
|
-
export
|
|
970
|
+
export const normalizeTableELement = (editor, element) => {
|
|
945
971
|
if (element.type !== ELEMENT_TYPE.TABLE) {
|
|
946
|
-
|
|
972
|
+
const size = [element.children.length, element.children[0].children.length];
|
|
947
973
|
return generateEmptyTable(editor, {
|
|
948
|
-
size
|
|
974
|
+
size
|
|
949
975
|
});
|
|
950
976
|
}
|
|
951
|
-
|
|
952
|
-
for (
|
|
953
|
-
|
|
954
|
-
for (
|
|
977
|
+
let newElement = _objectSpread({}, element);
|
|
978
|
+
for (let i = 0; i < element.children.length; i++) {
|
|
979
|
+
const row = newElement.children[i];
|
|
980
|
+
for (let j = 0; j < row.children.length; j++) {
|
|
955
981
|
row.children[j] = normalizeTableCell(row.children[j]);
|
|
956
982
|
}
|
|
957
983
|
newElement.children[i] = row;
|
|
958
984
|
}
|
|
959
985
|
return newElement;
|
|
960
986
|
};
|
|
961
|
-
export
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
size
|
|
987
|
+
export const insertTableByTemplate = (editor, alternateColor) => {
|
|
988
|
+
const size = [4, 4];
|
|
989
|
+
const tableNode = generateEmptyTable(editor, {
|
|
990
|
+
size,
|
|
965
991
|
alternate_highlight_color: alternateColor,
|
|
966
992
|
alternate_highlight: true
|
|
967
993
|
});
|
|
968
|
-
|
|
994
|
+
const path = Editor.path(editor, editor.selection);
|
|
969
995
|
Transforms.insertNodes(editor, tableNode, {
|
|
970
996
|
at: [path[0]]
|
|
971
997
|
});
|