@modusoperandi/licit 0.1.9 → 0.13.2
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/.github/workflows/build.yml +1 -7
- package/.github/workflows/lint.yml +1 -1
- package/README.md +1 -1
- package/babel.config.json +54 -0
- package/dist/BlockquoteNodeSpec.js +2 -2
- package/dist/CZIProseMirror.js +4 -4
- package/dist/CodeBlockCommand.js +2 -2
- package/dist/CodeBlockCommand.js.flow +1 -1
- package/dist/CursorPlaceholderPlugin.js +2 -2
- package/dist/DocLayoutCommand.js +2 -4
- package/dist/DocLayoutCommand.js.flow +1 -1
- package/dist/DocNodeSpec.js +1 -1
- package/dist/EditorCommands.js +23 -35
- package/dist/EditorCommands.js.flow +7 -7
- package/dist/EditorKeyMap.js +3 -3
- package/dist/FontTypeMarkSpec.js +1 -1
- package/dist/HeadingNodeSpec.js +2 -2
- package/dist/ImageSourceCommand.js +2 -4
- package/dist/ImageSourceCommand.js.flow +1 -1
- package/dist/ImageUploadPlaceholderPlugin.js +1 -1
- package/dist/LinkSetURLCommand.js +4 -8
- package/dist/LinkSetURLCommand.js.flow +3 -3
- package/dist/LinkTooltipPlugin.js +9 -15
- package/dist/LinkTooltipPlugin.js.flow +5 -5
- package/dist/ListToggleCommand.js +5 -11
- package/dist/ListToggleCommand.js.flow +3 -3
- package/dist/MarkNames.js +1 -1
- package/dist/MarksClearCommand.js +3 -3
- package/dist/MarksClearCommand.js.flow +1 -1
- package/dist/MathEditCommand.js +2 -2
- package/dist/MathEditCommand.js.flow +1 -1
- package/dist/ParagraphNodeSpec.js +3 -4
- package/dist/ParagraphNodeSpec.js.flow +2 -6
- package/dist/ParagraphSpacingCommand.js +3 -3
- package/dist/SelectionPlaceholderPlugin.js +2 -2
- package/dist/SpacerMarkSpec.js +1 -1
- package/dist/TableBackgroundColorCommand.js +3 -7
- package/dist/TableBackgroundColorCommand.js.flow +3 -3
- package/dist/TableBorderColorCommand.js +3 -7
- package/dist/TableBorderColorCommand.js.flow +3 -3
- package/dist/TableCellColorCommand.js +3 -7
- package/dist/TableCellColorCommand.js.flow +3 -3
- package/dist/TableCellMenuPlugin.js +4 -6
- package/dist/TableCellMenuPlugin.js.flow +3 -3
- package/dist/TableInsertCommand.js +3 -5
- package/dist/TableInsertCommand.js.flow +2 -2
- package/dist/TableResizePlugin.js +2 -2
- package/dist/TextInsertTabSpaceCommand.js +2 -4
- package/dist/TextInsertTabSpaceCommand.js.flow +1 -1
- package/dist/Types.js +1 -1
- package/dist/bom.xml +4970 -4167
- package/dist/client/CollabConnector.js +17 -2
- package/dist/client/CollabConnector.js.flow +17 -2
- package/dist/client/EditorConnection.js +15 -4
- package/dist/client/EditorConnection.js.flow +14 -3
- package/dist/client/Licit.js +73 -58
- package/dist/client/Licit.js.flow +101 -85
- package/dist/client/Licit.test.js +18 -17
- package/dist/client/Licit.test.js.flow +13 -11
- package/dist/client/SimpleConnector.js +4 -2
- package/dist/client/SimpleConnector.js.flow +3 -1
- package/dist/client/http.js +3 -3
- package/dist/convertToCSSPTValue.js +1 -1
- package/dist/createEmptyEditorState.js +1 -1
- package/dist/index.js +16 -16
- package/dist/joinListNode.js +2 -2
- package/dist/joinListNode.js.flow +1 -1
- package/dist/keymaps.js +2 -2
- package/dist/patchStyleElements.js +3 -3
- package/dist/patchStyleElements.js.flow +1 -1
- package/dist/splitListItem.js +2 -2
- package/dist/styles.css +2 -2
- package/dist/styles0.css +3 -3
- package/dist/toggleBlockquote.js +6 -14
- package/dist/toggleBlockquote.js.flow +4 -4
- package/dist/toggleCodeBlock.js +4 -10
- package/dist/toggleCodeBlock.js.flow +3 -3
- package/dist/ui/AlertInfo.js +2 -2
- package/dist/ui/CommandButton.js +2 -4
- package/dist/ui/CommandButton.js.flow +1 -1
- package/dist/ui/CommandMenuButton.js +5 -7
- package/dist/ui/CommandMenuButton.js.flow +2 -2
- package/dist/ui/CustomMenuItem.js +3 -5
- package/dist/ui/CustomMenuItem.js.flow +1 -1
- package/dist/ui/CustomNodeView.js +3 -3
- package/dist/ui/CustomRadioButton.js +8 -6
- package/dist/ui/CustomRadioButton.js.flow +3 -3
- package/dist/ui/DocLayoutEditor.js +5 -7
- package/dist/ui/DocLayoutEditor.js.flow +2 -2
- package/dist/ui/Editor.js +1 -2
- package/dist/ui/Editor.js.flow +1 -2
- package/dist/ui/EditorFrameset.js +1 -1
- package/dist/ui/EditorToolbar.js +4 -4
- package/dist/ui/EditorToolbar.js.flow +1 -1
- package/dist/ui/EditorToolbarConfig.js +1 -1
- package/dist/ui/FontSizeCommandMenuButton.js +3 -3
- package/dist/ui/FontSizeCommandMenuButton.js.flow +1 -1
- package/dist/ui/FontTypeCommandMenuButton.js +3 -3
- package/dist/ui/FontTypeCommandMenuButton.js.flow +1 -1
- package/dist/ui/ImageAlignEditor.js +5 -5
- package/dist/ui/ImageAlignEditor.js.flow +1 -1
- package/dist/ui/ImageInlineEditor.js +5 -5
- package/dist/ui/ImageInlineEditor.js.flow +1 -1
- package/dist/ui/ImageNodeView.js +5 -7
- package/dist/ui/ImageNodeView.js.flow +2 -2
- package/dist/ui/ImageResizeBox.js +4 -4
- package/dist/ui/ImageResizeBox.js.flow +1 -1
- package/dist/ui/ImageURLEditor.js +6 -8
- package/dist/ui/ImageURLEditor.js.flow +2 -2
- package/dist/ui/ImageUploadEditor.js +3 -5
- package/dist/ui/ImageUploadEditor.js.flow +2 -2
- package/dist/ui/LinkTooltip.js +4 -4
- package/dist/ui/LinkTooltip.js.flow +1 -1
- package/dist/ui/LinkURLEditor.js +4 -6
- package/dist/ui/LinkURLEditor.js.flow +2 -2
- package/dist/ui/ListTypeButton.js +5 -7
- package/dist/ui/ListTypeButton.js.flow +2 -2
- package/dist/ui/MathEditor.js +4 -6
- package/dist/ui/MathEditor.js.flow +2 -2
- package/dist/ui/MathInlineEditor.js +7 -9
- package/dist/ui/MathInlineEditor.js.flow +2 -2
- package/dist/ui/MathNodeView.js +5 -7
- package/dist/ui/MathNodeView.js.flow +2 -2
- package/dist/ui/ResizeObserver.js +1 -1
- package/dist/ui/TableGridSizeEditor.js +7 -9
- package/dist/ui/TableGridSizeEditor.js.flow +2 -2
- package/dist/ui/czi-link-tooltip.css +1 -1
- package/dist/ui/czi-vars.css +1 -45
- package/dist/ui/findActiveFontType.js +1 -1
- package/dist/ui/htmlElementToRect.js +1 -1
- package/dist/ui/isElementFullyVisible.js +2 -2
- package/dist/ui/isElementFullyVisible.js.flow +1 -1
- package/dist/ui/mathquill-editor/MathQuillEditorSymbols.js +1 -1
- package/dist/ui/mathquill-editor/MathQuillEditorSymbolsPanel.js +2 -2
- package/dist/ui/mathquill-editor/MathQuillEditorSymbolsPanel.js.flow +1 -1
- package/dist/ui/resolveImage.js +3 -3
- package/dist/ui/toCSSColor.js +1 -1
- package/dist/ui/toCSSLineSpacing.js +1 -36
- package/dist/ui/toCSSLineSpacing.js.flow +0 -27
- package/flow-typed/@modusoperandilicit-ui-commands.js +5 -0
- package/jest.config.js +207 -0
- package/lint.sh +0 -0
- package/node_modules/prosemirror-utils/LICENSE +13 -0
- package/{dist/ui/PopUpTypes.js.flow → node_modules/prosemirror-utils/README.md} +0 -0
- package/node_modules/prosemirror-utils/dist/helpers.js +119 -0
- package/node_modules/prosemirror-utils/dist/index.js +17 -0
- package/node_modules/prosemirror-utils/dist/index.js.map +1 -0
- package/node_modules/prosemirror-utils/dist/node.js +106 -0
- package/node_modules/prosemirror-utils/dist/selection.js +168 -0
- package/node_modules/prosemirror-utils/dist/transforms.js +257 -0
- package/node_modules/prosemirror-utils/package.json +81 -0
- package/node_modules/prosemirror-utils/typings.d.ts +79 -0
- package/package.json +14 -8
- package/scripts/build_bin.py +0 -0
- package/scripts/ci_check_dist.sh +0 -0
- package/src/CodeBlockCommand.js +1 -1
- package/src/DocLayoutCommand.js +1 -1
- package/src/EditorCommands.js +7 -7
- package/src/ImageSourceCommand.js +1 -1
- package/src/LinkSetURLCommand.js +3 -3
- package/src/LinkTooltipPlugin.js +5 -5
- package/src/ListToggleCommand.js +3 -3
- package/src/MarksClearCommand.js +1 -1
- package/src/MathEditCommand.js +1 -1
- package/src/ParagraphNodeSpec.js +2 -6
- package/src/TableBackgroundColorCommand.js +3 -3
- package/src/TableBorderColorCommand.js +3 -3
- package/src/TableCellColorCommand.js +3 -3
- package/src/TableCellMenuPlugin.js +3 -3
- package/src/TableInsertCommand.js +2 -2
- package/src/TextInsertTabSpaceCommand.js +1 -1
- package/src/client/CollabConnector.js +17 -2
- package/src/client/EditorConnection.js +14 -3
- package/src/client/Licit.js +101 -85
- package/src/client/Licit.test.js +13 -11
- package/src/client/SimpleConnector.js +3 -1
- package/src/joinListNode.js +1 -1
- package/src/patchStyleElements.js +1 -1
- package/src/styles.css +2 -2
- package/src/styles0.css +3 -3
- package/src/toggleBlockquote.js +4 -4
- package/src/toggleCodeBlock.js +3 -3
- package/src/ui/CommandButton.js +1 -1
- package/src/ui/CommandMenuButton.js +2 -2
- package/src/ui/CustomMenuItem.js +1 -1
- package/src/ui/CustomRadioButton.js +3 -3
- package/src/ui/DocLayoutEditor.js +2 -2
- package/src/ui/Editor.js +1 -2
- package/src/ui/EditorToolbar.js +1 -1
- package/src/ui/FontSizeCommandMenuButton.js +1 -1
- package/src/ui/FontTypeCommandMenuButton.js +1 -1
- package/src/ui/ImageAlignEditor.js +1 -1
- package/src/ui/ImageInlineEditor.js +1 -1
- package/src/ui/ImageNodeView.js +2 -2
- package/src/ui/ImageResizeBox.js +1 -1
- package/src/ui/ImageURLEditor.js +2 -2
- package/src/ui/ImageUploadEditor.js +2 -2
- package/src/ui/LinkTooltip.js +1 -1
- package/src/ui/LinkURLEditor.js +2 -2
- package/src/ui/ListTypeButton.js +2 -2
- package/src/ui/MathEditor.js +2 -2
- package/src/ui/MathInlineEditor.js +2 -2
- package/src/ui/MathNodeView.js +2 -2
- package/src/ui/TableGridSizeEditor.js +2 -2
- package/src/ui/czi-link-tooltip.css +1 -1
- package/src/ui/czi-vars.css +1 -45
- package/src/ui/isElementFullyVisible.js +1 -1
- package/src/ui/mathquill-editor/MathQuillEditorSymbolsPanel.js +1 -1
- package/src/ui/toCSSLineSpacing.js +0 -27
- package/build_customstyle_server.py +0 -7
- package/dist/FontSizeCommand.js +0 -80
- package/dist/FontSizeCommand.js.flow +0 -57
- package/dist/FontTypeCommand.js +0 -137
- package/dist/FontTypeCommand.js.flow +0 -100
- package/dist/HeadingCommand.js +0 -65
- package/dist/HeadingCommand.js.flow +0 -51
- package/dist/IndentCommand.js +0 -57
- package/dist/IndentCommand.js.flow +0 -41
- package/dist/MarkToggleCommand.js +0 -90
- package/dist/MarkToggleCommand.js.flow +0 -66
- package/dist/TextAlignCommand.js +0 -151
- package/dist/TextAlignCommand.js.flow +0 -122
- package/dist/TextColorCommand.js +0 -114
- package/dist/TextColorCommand.js.flow +0 -87
- package/dist/TextHighlightCommand.js +0 -118
- package/dist/TextHighlightCommand.js.flow +0 -91
- package/dist/TextLineSpacingCommand.js +0 -177
- package/dist/TextLineSpacingCommand.js.flow +0 -157
- package/dist/applyMark.js +0 -84
- package/dist/applyMark.js.flow +0 -61
- package/dist/clearMarks.js +0 -160
- package/dist/clearMarks.js.flow +0 -128
- package/dist/compareNumber.js +0 -18
- package/dist/compareNumber.js.flow +0 -11
- package/dist/consolidateListNodes.js +0 -291
- package/dist/consolidateListNodes.js.flow +0 -281
- package/dist/coverage/lcov-report/block-navigation.js +0 -77
- package/dist/coverage/lcov-report/block-navigation.js.flow +0 -79
- package/dist/coverage/lcov-report/prettify.js +0 -994
- package/dist/coverage/lcov-report/prettify.js.flow +0 -2
- package/dist/coverage/lcov-report/sorter.js +0 -187
- package/dist/coverage/lcov-report/sorter.js.flow +0 -170
- package/dist/findNodesWithSameMark.js +0 -89
- package/dist/findNodesWithSameMark.js.flow +0 -89
- package/dist/isBulletListNode.js +0 -14
- package/dist/isBulletListNode.js.flow +0 -9
- package/dist/isInsideListItem.js +0 -19
- package/dist/isInsideListItem.js.flow +0 -13
- package/dist/isListNode.js +0 -22
- package/dist/isListNode.js.flow +0 -13
- package/dist/isNodeSelectionForNodeType.js +0 -19
- package/dist/isNodeSelectionForNodeType.js.flow +0 -15
- package/dist/isOrderedListNode.js +0 -14
- package/dist/isOrderedListNode.js.flow +0 -9
- package/dist/isTextStyleMarkCommandEnabled.js +0 -59
- package/dist/isTextStyleMarkCommandEnabled.js.flow +0 -49
- package/dist/noop.js +0 -11
- package/dist/noop.js.flow +0 -5
- package/dist/toggleHeading.js +0 -135
- package/dist/toggleHeading.js.flow +0 -113
- package/dist/toggleList.js +0 -431
- package/dist/toggleList.js.flow +0 -450
- package/dist/transformAndPreserveTextSelection.js +0 -173
- package/dist/transformAndPreserveTextSelection.js.flow +0 -151
- package/dist/ui/ColorEditor.js +0 -118
- package/dist/ui/ColorEditor.js.flow +0 -101
- package/dist/ui/CustomButton.js +0 -62
- package/dist/ui/CustomButton.js.flow +0 -33
- package/dist/ui/PointerSurface.js +0 -173
- package/dist/ui/PointerSurface.js.flow +0 -141
- package/dist/ui/PopUp.js +0 -129
- package/dist/ui/PopUp.js.flow +0 -77
- package/dist/ui/PopUpManager.js +0 -266
- package/dist/ui/PopUpManager.js.flow +0 -213
- package/dist/ui/PopUpPosition.js +0 -156
- package/dist/ui/PopUpPosition.js.flow +0 -104
- package/dist/ui/PopUpTypes.js +0 -1
- package/dist/ui/TooltipSurface.js +0 -99
- package/dist/ui/TooltipSurface.js.flow +0 -76
- package/dist/ui/clamp.js +0 -18
- package/dist/ui/clamp.js.flow +0 -11
- package/dist/ui/createPopUp.js +0 -199
- package/dist/ui/createPopUp.js.flow +0 -205
- package/dist/ui/czi-animations.css +0 -15
- package/dist/ui/czi-color-editor.css +0 -56
- package/dist/ui/czi-custom-button.css +0 -93
- package/dist/ui/czi-pop-up.css +0 -32
- package/dist/ui/czi-tooltip-surface.css +0 -45
- package/dist/ui/preventEventDefault.js +0 -10
- package/dist/ui/preventEventDefault.js.flow +0 -5
- package/dist/ui/rects.js +0 -58
- package/dist/ui/rects.js.flow +0 -47
- package/dist/updateIndentLevel.js +0 -232
- package/dist/updateIndentLevel.js.flow +0 -211
- package/flow-typed/@molicit-citation.js +0 -5
- package/licit/server/customstyles/start.js +0 -184
- package/run_customstyle_server.py +0 -20
- package/src/FontSizeCommand.js +0 -57
- package/src/FontTypeCommand.js +0 -100
- package/src/HeadingCommand.js +0 -51
- package/src/IndentCommand.js +0 -41
- package/src/MarkToggleCommand.js +0 -66
- package/src/TextAlignCommand.js +0 -122
- package/src/TextColorCommand.js +0 -87
- package/src/TextHighlightCommand.js +0 -91
- package/src/TextLineSpacingCommand.js +0 -157
- package/src/applyMark.js +0 -61
- package/src/clearMarks.js +0 -128
- package/src/compareNumber.js +0 -11
- package/src/consolidateListNodes.js +0 -281
- package/src/findNodesWithSameMark.js +0 -89
- package/src/isBulletListNode.js +0 -9
- package/src/isInsideListItem.js +0 -13
- package/src/isListNode.js +0 -13
- package/src/isNodeSelectionForNodeType.js +0 -15
- package/src/isOrderedListNode.js +0 -9
- package/src/isTextStyleMarkCommandEnabled.js +0 -49
- package/src/noop.js +0 -5
- package/src/toggleHeading.js +0 -113
- package/src/toggleList.js +0 -450
- package/src/transformAndPreserveTextSelection.js +0 -151
- package/src/ui/ColorEditor.js +0 -101
- package/src/ui/CustomButton.js +0 -33
- package/src/ui/PointerSurface.js +0 -141
- package/src/ui/PopUp.js +0 -77
- package/src/ui/PopUpManager.js +0 -213
- package/src/ui/PopUpPosition.js +0 -104
- package/src/ui/PopUpTypes.js +0 -0
- package/src/ui/TooltipSurface.js +0 -76
- package/src/ui/clamp.js +0 -11
- package/src/ui/createPopUp.js +0 -205
- package/src/ui/czi-animations.css +0 -15
- package/src/ui/czi-color-editor.css +0 -56
- package/src/ui/czi-custom-button.css +0 -93
- package/src/ui/czi-pop-up.css +0 -32
- package/src/ui/czi-tooltip-surface.css +0 -45
- package/src/ui/preventEventDefault.js +0 -5
- package/src/ui/rects.js +0 -47
- package/src/updateIndentLevel.js +0 -211
- package/utils/build_customstyle_server.js +0 -72
package/src/ui/createPopUp.js
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import './czi-vars.css';
|
|
4
|
-
import './czi-pop-up.css';
|
|
5
|
-
|
|
6
|
-
import type { PopUpParams, ViewProps } from './PopUp';
|
|
7
|
-
|
|
8
|
-
import PopUp from './PopUp';
|
|
9
|
-
// eslint-disable-next-line no-unused-vars
|
|
10
|
-
import * as React from 'react';
|
|
11
|
-
import ReactDOM from 'react-dom';
|
|
12
|
-
import uuid from './uuid';
|
|
13
|
-
|
|
14
|
-
export type PopUpHandle = {
|
|
15
|
-
close: (val: any) => void,
|
|
16
|
-
update: (props: Object) => void,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
let modalsCount = 0;
|
|
20
|
-
let popUpsCount = 0;
|
|
21
|
-
|
|
22
|
-
const Z_INDEX_BASE = 9999;
|
|
23
|
-
const MODAL_MASK_ID = 'pop-up-modal-mask-' + uuid();
|
|
24
|
-
|
|
25
|
-
function showModalMask(IsChildDialog: ?boolean): void {
|
|
26
|
-
const root: any = document.body || document.documentElement;
|
|
27
|
-
let element = document.getElementById(MODAL_MASK_ID);
|
|
28
|
-
if (!element) {
|
|
29
|
-
element = document.createElement('div');
|
|
30
|
-
element.id = MODAL_MASK_ID;
|
|
31
|
-
// [FS] IRAD-1048 2020-10-07
|
|
32
|
-
// To handle child dialog window
|
|
33
|
-
if (IsChildDialog) {
|
|
34
|
-
element.className = 'czi-pop-up-modal-mask child-modal';
|
|
35
|
-
element.setAttribute(
|
|
36
|
-
'data-mask-type',
|
|
37
|
-
'czi-pop-up-modal-mask child-modal'
|
|
38
|
-
);
|
|
39
|
-
} else {
|
|
40
|
-
element.className = 'czi-pop-up-modal-mask';
|
|
41
|
-
element.setAttribute('data-mask-type', 'czi-pop-up-modal-mask');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
element.setAttribute('role', 'dialog');
|
|
45
|
-
element.setAttribute('aria-modal', 'true');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (root && !element.parentElement) {
|
|
49
|
-
root.appendChild(element);
|
|
50
|
-
}
|
|
51
|
-
const style: any = element.style;
|
|
52
|
-
|
|
53
|
-
const selector = '.czi-pop-up-element[data-pop-up-modal]';
|
|
54
|
-
const zIndex = Array.from(document.querySelectorAll(selector)).reduce(
|
|
55
|
-
(zz, el) => Math.max(zz, Number(el.style.zIndex)),
|
|
56
|
-
0
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
style.zIndex = zIndex - 1;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function hideModalMask(): void {
|
|
63
|
-
const element = document.getElementById(MODAL_MASK_ID);
|
|
64
|
-
if (element && element.parentElement) {
|
|
65
|
-
element.parentElement.removeChild(element);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function getRootElement(
|
|
70
|
-
id: string,
|
|
71
|
-
forceCreation: boolean,
|
|
72
|
-
popUpParams: ?PopUpParams
|
|
73
|
-
): ?HTMLElement {
|
|
74
|
-
const root: any =
|
|
75
|
-
(popUpParams && popUpParams.container) ||
|
|
76
|
-
document.body ||
|
|
77
|
-
document.documentElement;
|
|
78
|
-
let element = document.getElementById(id);
|
|
79
|
-
if (!element && forceCreation) {
|
|
80
|
-
element = document.createElement('div');
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (!element) {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (popUpParams && popUpParams.modal) {
|
|
88
|
-
element.setAttribute('data-pop-up-modal', 'y');
|
|
89
|
-
}
|
|
90
|
-
// [FS] IRAD-1048 2020-10-07
|
|
91
|
-
// To handle child dialog window
|
|
92
|
-
if (popUpParams && popUpParams.IsChildDialog) {
|
|
93
|
-
element.className = 'czi-pop-up-element child-modal czi-vars';
|
|
94
|
-
} else {
|
|
95
|
-
element.className = 'czi-pop-up-element czi-vars';
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
element.id = id;
|
|
99
|
-
const style: any = element.style;
|
|
100
|
-
const modalZIndexOffset = popUpParams && popUpParams.modal ? 1 : 0;
|
|
101
|
-
if (!(popUpParams && popUpParams.container)) {
|
|
102
|
-
style.zIndex = Z_INDEX_BASE + popUpsCount * 3 + modalZIndexOffset;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Populates the default ARIA attributes here.
|
|
106
|
-
// http://accessibility.athena-ict.com/aria/examples/dialog.shtml
|
|
107
|
-
element.setAttribute('role', 'dialog');
|
|
108
|
-
element.setAttribute('aria-modal', 'true');
|
|
109
|
-
if (root && !element.parentElement) {
|
|
110
|
-
root.appendChild(element);
|
|
111
|
-
}
|
|
112
|
-
return element;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function renderPopUp(
|
|
116
|
-
rootId: string,
|
|
117
|
-
close: Function,
|
|
118
|
-
View: Function,
|
|
119
|
-
viewProps: ViewProps,
|
|
120
|
-
popUpParams: PopUpParams
|
|
121
|
-
): void {
|
|
122
|
-
const rootNode = getRootElement(rootId, true, popUpParams);
|
|
123
|
-
if (rootNode) {
|
|
124
|
-
const component = (
|
|
125
|
-
<PopUp
|
|
126
|
-
View={View}
|
|
127
|
-
close={close}
|
|
128
|
-
popUpParams={popUpParams}
|
|
129
|
-
viewProps={viewProps}
|
|
130
|
-
/>
|
|
131
|
-
);
|
|
132
|
-
ReactDOM.render(component, rootNode);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (modalsCount > 0) {
|
|
136
|
-
showModalMask(popUpParams.IsChildDialog);
|
|
137
|
-
} else {
|
|
138
|
-
hideModalMask();
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function unrenderPopUp(rootId: string): void {
|
|
143
|
-
const rootNode = getRootElement(rootId, false);
|
|
144
|
-
if (rootNode) {
|
|
145
|
-
ReactDOM.unmountComponentAtNode(rootNode);
|
|
146
|
-
rootNode.parentElement && rootNode.parentElement.removeChild(rootNode);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (modalsCount === 0) {
|
|
150
|
-
hideModalMask();
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export default function createPopUp(
|
|
155
|
-
View: Function,
|
|
156
|
-
viewProps?: ?ViewProps,
|
|
157
|
-
popUpParams?: ?PopUpParams
|
|
158
|
-
): PopUpHandle {
|
|
159
|
-
const rootId = uuid();
|
|
160
|
-
|
|
161
|
-
let handle = null;
|
|
162
|
-
let currentViewProps = viewProps;
|
|
163
|
-
|
|
164
|
-
viewProps = viewProps || {};
|
|
165
|
-
popUpParams = popUpParams || {};
|
|
166
|
-
|
|
167
|
-
const modal = popUpParams.modal || !popUpParams.anchor;
|
|
168
|
-
popUpParams.modal = modal;
|
|
169
|
-
|
|
170
|
-
popUpsCount++;
|
|
171
|
-
if (modal) {
|
|
172
|
-
modalsCount++;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
const closePopUp = (value) => {
|
|
176
|
-
if (!handle) {
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
if (modal) {
|
|
181
|
-
modalsCount--;
|
|
182
|
-
}
|
|
183
|
-
popUpsCount--;
|
|
184
|
-
|
|
185
|
-
handle = null;
|
|
186
|
-
unrenderPopUp(rootId);
|
|
187
|
-
|
|
188
|
-
const onClose = popUpParams && popUpParams.onClose;
|
|
189
|
-
onClose && onClose(value);
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
const render = renderPopUp.bind(null, rootId, closePopUp, View);
|
|
193
|
-
const emptyObj = {};
|
|
194
|
-
|
|
195
|
-
handle = {
|
|
196
|
-
close: closePopUp,
|
|
197
|
-
update: (nextViewProps) => {
|
|
198
|
-
currentViewProps = nextViewProps;
|
|
199
|
-
render(currentViewProps || emptyObj, popUpParams || emptyObj);
|
|
200
|
-
},
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
render(currentViewProps || emptyObj, popUpParams);
|
|
204
|
-
return handle;
|
|
205
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
@import './czi-vars.css';
|
|
2
|
-
|
|
3
|
-
.czi-color-editor {
|
|
4
|
-
background: #fff;
|
|
5
|
-
box-shadow: var(--czi-overlay-shadow);
|
|
6
|
-
font-family: var(--czi-font-family);
|
|
7
|
-
font-size: var(--czi-font-size);
|
|
8
|
-
padding-bottom: 4px;
|
|
9
|
-
padding-left: 10px;
|
|
10
|
-
padding-right: 10px;
|
|
11
|
-
padding-top: 4px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.czi-color-editor .czi-custom-button {
|
|
15
|
-
border-color: #fff;
|
|
16
|
-
border-style: solid;
|
|
17
|
-
border-width: 1px;
|
|
18
|
-
border: solid 1px #fff;
|
|
19
|
-
box-sizing: border-box;
|
|
20
|
-
height: 18px;
|
|
21
|
-
margin: 1px;
|
|
22
|
-
padding: 0;
|
|
23
|
-
width: 18px;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.czi-color-editor .czi-custom-button.czi-color-editor-color-transparent {
|
|
27
|
-
box-sizing: border-box;
|
|
28
|
-
display: block;
|
|
29
|
-
height: auto;
|
|
30
|
-
margin: 2px;
|
|
31
|
-
padding: 6px;
|
|
32
|
-
text-align: center;
|
|
33
|
-
width: auto;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.czi-color-editor .czi-custom-button.czi-color-editor-color-transparent:hover {
|
|
37
|
-
background-color: var(--czi-button-hover-background-color);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.czi-color-editor .czi-custom-button.active,
|
|
41
|
-
.czi-color-editor .czi-custom-button:hover {
|
|
42
|
-
font-weight: normal;
|
|
43
|
-
outline: solid 1px #000;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.czi-color-editor-section {
|
|
47
|
-
margin-bottom: 8px;
|
|
48
|
-
margin-left: 0;
|
|
49
|
-
margin-right: 0;
|
|
50
|
-
margin-top: 8px;
|
|
51
|
-
width: 200px;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.czi-color-editor-section .czi-color-editor-cell {
|
|
55
|
-
border-radius: 0;
|
|
56
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/* <CustomButton /> */
|
|
2
|
-
@import './czi-vars.css';
|
|
3
|
-
|
|
4
|
-
.czi-custom-buttons {
|
|
5
|
-
margin-bottom: 0;
|
|
6
|
-
margin-left: 8px;
|
|
7
|
-
margin-right: 8px;
|
|
8
|
-
margin-top: 0;
|
|
9
|
-
white-space: nowrap;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.czi-custom-button {
|
|
13
|
-
background-clip: padding-box;
|
|
14
|
-
background-color: #fff;
|
|
15
|
-
border: var(--czi-border-grey);
|
|
16
|
-
border-radius: 5px;
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
color: var(--czi-button-text-color);
|
|
19
|
-
cursor: pointer;
|
|
20
|
-
display: inline-block;
|
|
21
|
-
font-family: var(--czi-font-family);
|
|
22
|
-
font-size: var(--czi-font-size);
|
|
23
|
-
font-weight: normal;
|
|
24
|
-
line-height: 1.2em;
|
|
25
|
-
overflow: hidden;
|
|
26
|
-
padding-bottom: 6px;
|
|
27
|
-
padding-left: 12px;
|
|
28
|
-
padding-right: 12px;
|
|
29
|
-
padding-top: 6px;
|
|
30
|
-
position: relative;
|
|
31
|
-
text-overflow: ellipsis;
|
|
32
|
-
user-select: none;
|
|
33
|
-
vertical-align: middle;
|
|
34
|
-
white-space: nowrap;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.czi-custom-button.use-icon {
|
|
38
|
-
border-color: transparent;
|
|
39
|
-
padding: 0;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.czi-custom-button:focus,
|
|
43
|
-
.czi-custom-button:hover {
|
|
44
|
-
background-color: #f0f0f0;
|
|
45
|
-
border-color: #555;
|
|
46
|
-
outline: none;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.czi-custom-button.active {
|
|
50
|
-
/*
|
|
51
|
-
* Use text-stroke to strengthen teh text, do not use "bold" because it will
|
|
52
|
-
* cause layout reflow.
|
|
53
|
-
* Firefox & Edge specifically only support the -webkit-text-stroke property.
|
|
54
|
-
* https://caniuse.com/#feat=text-stroke
|
|
55
|
-
*/
|
|
56
|
-
border-color: #666;
|
|
57
|
-
color: #000;
|
|
58
|
-
-webkit-text-stroke-color: #000;
|
|
59
|
-
-webkit-text-stroke-width: 0.5px;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.czi-custom-button.pressed {
|
|
63
|
-
background-color: #e0e0e0;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.czi-custom-button.disabled,
|
|
67
|
-
.czi-custom-button.disabled:hover {
|
|
68
|
-
background: #fff;
|
|
69
|
-
border-color: #ccc;
|
|
70
|
-
color: #dedede;
|
|
71
|
-
cursor: unset;
|
|
72
|
-
pointer-events: none;
|
|
73
|
-
-webkit-text-stroke-width: 0;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.czi-custom-buttons .czi-custom-button {
|
|
77
|
-
border-radius: 0;
|
|
78
|
-
margin-left: 0;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.czi-custom-buttons > .czi-custom-button:first-of-type {
|
|
82
|
-
border-bottom-left-radius: var(--czi-button-radius);
|
|
83
|
-
border-top-left-radius: var(--czi-button-radius);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.czi-custom-buttons > .czi-custom-button:last-child {
|
|
87
|
-
border-bottom-right-radius: var(--czi-button-radius);
|
|
88
|
-
border-top-right-radius: var(--czi-button-radius);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.czi-custom-buttons > .czi-custom-button:only-child {
|
|
92
|
-
border-radius: var(--czi-button-radius);
|
|
93
|
-
}
|
package/src/ui/czi-pop-up.css
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
@import './czi-vars.css';
|
|
2
|
-
|
|
3
|
-
.czi-pop-up-modal-mask,
|
|
4
|
-
.czi-pop-up-element {
|
|
5
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
6
|
-
height: 100vh;
|
|
7
|
-
left: 0;
|
|
8
|
-
position: fixed;
|
|
9
|
-
top: 0;
|
|
10
|
-
width: 100vw;
|
|
11
|
-
z-index: 5000;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/* [FS] IRAD-1048 2020-10-07
|
|
15
|
-
To handle child dialog window */
|
|
16
|
-
.child-modal {
|
|
17
|
-
background-color: unset !important;
|
|
18
|
-
z-index: 100006 !important;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.czi-pop-up-element {
|
|
22
|
-
background-color: transparent;
|
|
23
|
-
height: auto;
|
|
24
|
-
width: auto;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.czi-pop-up-element a:link,
|
|
28
|
-
.czi-pop-up-element a:visited,
|
|
29
|
-
.czi-pop-up-element a:hover,
|
|
30
|
-
.czi-pop-up-element a:active {
|
|
31
|
-
color: var(--czi-link-color);
|
|
32
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
@import './czi-vars.css';
|
|
2
|
-
@import './czi-animations.css';
|
|
3
|
-
|
|
4
|
-
.czi-tooltip-surface.czi-animation-fade-in {
|
|
5
|
-
display: contents;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.czi-tooltip-view {
|
|
9
|
-
background-color: #393939;
|
|
10
|
-
border-radius: 5px;
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
color: #fff;
|
|
13
|
-
font-family: var(--czi-font-family);
|
|
14
|
-
font-size: var(--czi-font-size);
|
|
15
|
-
margin: 20px 0 0 0;
|
|
16
|
-
min-width: 100px;
|
|
17
|
-
padding: 6px 8px;
|
|
18
|
-
pointer-events: none;
|
|
19
|
-
text-align: center;
|
|
20
|
-
user-select: none;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@media only print {
|
|
24
|
-
.czi-tooltip-view {
|
|
25
|
-
display: none;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.czi-tooltip-view.czi-animation-fade-in {
|
|
30
|
-
animation-delay: 150ms;
|
|
31
|
-
animation-duration: 250ms;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.czi-tooltip-view::after {
|
|
35
|
-
background-color: #393939;
|
|
36
|
-
content: '';
|
|
37
|
-
height: 8px;
|
|
38
|
-
left: var(--czi-pop-up-anchor-offset-left);
|
|
39
|
-
margin-left: -6px;
|
|
40
|
-
position: absolute;
|
|
41
|
-
top: 16px;
|
|
42
|
-
transform: rotate(45deg);
|
|
43
|
-
width: 8px;
|
|
44
|
-
z-index: -1;
|
|
45
|
-
}
|
package/src/ui/rects.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
export type Rect = {
|
|
4
|
-
h: number,
|
|
5
|
-
w: number,
|
|
6
|
-
x: number,
|
|
7
|
-
y: number,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export function isCollapsed(rect: Rect): boolean {
|
|
11
|
-
return rect.w === 0 || rect.h === 0;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function isIntersected(r1: Rect, r2: Rect, padding: ?number): boolean {
|
|
15
|
-
const pp = padding || 0;
|
|
16
|
-
return !(
|
|
17
|
-
r2.x - pp > r1.x + r1.w + pp ||
|
|
18
|
-
r2.x + r2.w + pp < r1.x - pp ||
|
|
19
|
-
r2.y - pp > r1.y + r1.h + pp ||
|
|
20
|
-
r2.y + r2.h + pp < r1.y - pp
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function fromXY(x: number, y: number, padding: ?number): Rect {
|
|
25
|
-
padding = padding || 0;
|
|
26
|
-
return {
|
|
27
|
-
x: x - padding,
|
|
28
|
-
y: y - padding,
|
|
29
|
-
w: padding * 2,
|
|
30
|
-
h: padding * 2,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function fromHTMlElement(el: HTMLElement): Rect {
|
|
35
|
-
const display = document.defaultView.getComputedStyle(el).display;
|
|
36
|
-
if (display === 'contents' && el.children.length === 1) {
|
|
37
|
-
// el has no layout at all, use its children instead.
|
|
38
|
-
return fromHTMlElement(el.children[0]);
|
|
39
|
-
}
|
|
40
|
-
const rect = el.getBoundingClientRect();
|
|
41
|
-
return {
|
|
42
|
-
x: rect.left,
|
|
43
|
-
y: rect.top,
|
|
44
|
-
w: rect.width,
|
|
45
|
-
h: rect.height,
|
|
46
|
-
};
|
|
47
|
-
}
|
package/src/updateIndentLevel.js
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import clamp from './ui/clamp';
|
|
3
|
-
import compareNumber from './compareNumber';
|
|
4
|
-
import consolidateListNodes from './consolidateListNodes';
|
|
5
|
-
import isListNode from './isListNode';
|
|
6
|
-
import transformAndPreserveTextSelection from './transformAndPreserveTextSelection';
|
|
7
|
-
import { EditorState, AllSelection, TextSelection } from 'prosemirror-state';
|
|
8
|
-
import { BLOCKQUOTE, HEADING, LIST_ITEM, PARAGRAPH } from './NodeNames';
|
|
9
|
-
import { Fragment, Schema } from 'prosemirror-model';
|
|
10
|
-
import { MAX_INDENT_LEVEL, MIN_INDENT_LEVEL } from './ParagraphNodeSpec';
|
|
11
|
-
import { Transform } from 'prosemirror-transform';
|
|
12
|
-
import { EditorView } from 'prosemirror-view';
|
|
13
|
-
|
|
14
|
-
export default function updateIndentLevel(
|
|
15
|
-
state: EditorState,
|
|
16
|
-
tr: Transform,
|
|
17
|
-
schema: Schema,
|
|
18
|
-
delta: number,
|
|
19
|
-
view: EditorView
|
|
20
|
-
): Transform {
|
|
21
|
-
const { doc, selection } = tr;
|
|
22
|
-
if (!doc || !selection) {
|
|
23
|
-
return { tr, docChanged: false };
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
!(selection instanceof TextSelection || selection instanceof AllSelection)
|
|
28
|
-
) {
|
|
29
|
-
return { tr, docChanged: false };
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const { nodes } = schema;
|
|
33
|
-
const { from, to } = selection;
|
|
34
|
-
const listNodePoses = [];
|
|
35
|
-
const blockquote = nodes[BLOCKQUOTE];
|
|
36
|
-
const heading = nodes[HEADING];
|
|
37
|
-
const paragraph = nodes[PARAGRAPH];
|
|
38
|
-
|
|
39
|
-
doc.nodesBetween(from, to, (node, pos) => {
|
|
40
|
-
const nodeType = node.type;
|
|
41
|
-
if (
|
|
42
|
-
nodeType === paragraph ||
|
|
43
|
-
nodeType === heading ||
|
|
44
|
-
nodeType === blockquote
|
|
45
|
-
) {
|
|
46
|
-
tr = setNodeIndentMarkup(state, tr, pos, delta, view).tr;
|
|
47
|
-
return false;
|
|
48
|
-
} else if (isListNode(node)) {
|
|
49
|
-
// List is tricky, we'll handle it later.
|
|
50
|
-
listNodePoses.push(pos);
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
return true;
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
if (!listNodePoses.length) {
|
|
57
|
-
return { tr, docChanged: true };
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
tr = transformAndPreserveTextSelection(tr, schema, (memo) => {
|
|
61
|
-
const { schema } = memo;
|
|
62
|
-
let tr2 = memo.tr;
|
|
63
|
-
listNodePoses
|
|
64
|
-
.sort(compareNumber)
|
|
65
|
-
.reverse()
|
|
66
|
-
.forEach((pos) => {
|
|
67
|
-
tr2 = setListNodeIndent(state, tr2, schema, pos, delta);
|
|
68
|
-
});
|
|
69
|
-
tr2 = consolidateListNodes(tr2);
|
|
70
|
-
return tr2;
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
return { tr, docChanged: true };
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function setListNodeIndent(
|
|
77
|
-
state: EditorState,
|
|
78
|
-
tr: Transform,
|
|
79
|
-
schema: Schema,
|
|
80
|
-
pos: number,
|
|
81
|
-
delta: number
|
|
82
|
-
): Transform {
|
|
83
|
-
const listItem = schema.nodes[LIST_ITEM];
|
|
84
|
-
if (!listItem) {
|
|
85
|
-
return tr;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const { doc, selection } = tr;
|
|
89
|
-
if (!doc) {
|
|
90
|
-
return tr;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const listNode = doc.nodeAt(pos);
|
|
94
|
-
if (!listNode) {
|
|
95
|
-
return tr;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const indentNew = clamp(
|
|
99
|
-
MIN_INDENT_LEVEL,
|
|
100
|
-
listNode.attrs.indent + delta,
|
|
101
|
-
MAX_INDENT_LEVEL
|
|
102
|
-
);
|
|
103
|
-
if (indentNew === listNode.attrs.indent) {
|
|
104
|
-
return tr;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const { from, to } = selection;
|
|
108
|
-
|
|
109
|
-
// [FS] IRAD-947 2020-05-19
|
|
110
|
-
// Fix for Multi-level lists lose multi-levels when indenting/de-indenting
|
|
111
|
-
// Earlier they checked the to postion value to >= pos + listNode.nodeSize
|
|
112
|
-
// It wont satisfy the list hve childrens
|
|
113
|
-
|
|
114
|
-
if (from <= pos && to >= pos) {
|
|
115
|
-
return setNodeIndentMarkup(state, tr, pos, delta).tr;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const listNodeType = listNode.type;
|
|
119
|
-
|
|
120
|
-
// listNode is partially selected.
|
|
121
|
-
const itemsBefore = [];
|
|
122
|
-
const itemsSelected = [];
|
|
123
|
-
const itemsAfter = [];
|
|
124
|
-
|
|
125
|
-
doc.nodesBetween(pos, pos + listNode.nodeSize, (itemNode, itemPos) => {
|
|
126
|
-
if (itemNode.type === listNodeType) {
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (itemNode.type === listItem) {
|
|
131
|
-
const listItemNode = listItem.create(
|
|
132
|
-
itemNode.attrs,
|
|
133
|
-
itemNode.content,
|
|
134
|
-
itemNode.marks
|
|
135
|
-
);
|
|
136
|
-
if (itemPos + itemNode.nodeSize <= from) {
|
|
137
|
-
itemsBefore.push(listItemNode);
|
|
138
|
-
} else if (itemPos > to) {
|
|
139
|
-
itemsAfter.push(listItemNode);
|
|
140
|
-
} else {
|
|
141
|
-
itemsSelected.push(listItemNode);
|
|
142
|
-
}
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return true;
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
tr = tr.delete(pos, pos + listNode.nodeSize);
|
|
150
|
-
if (itemsAfter.length) {
|
|
151
|
-
const listNodeNew = listNodeType.create(
|
|
152
|
-
listNode.attrs,
|
|
153
|
-
Fragment.from(itemsAfter)
|
|
154
|
-
);
|
|
155
|
-
tr = tr.insert(pos, Fragment.from(listNodeNew));
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (itemsSelected.length) {
|
|
159
|
-
const listNodeAttrs = {
|
|
160
|
-
...listNode.attrs,
|
|
161
|
-
indent: indentNew,
|
|
162
|
-
};
|
|
163
|
-
const listNodeNew = listNodeType.create(
|
|
164
|
-
listNodeAttrs,
|
|
165
|
-
Fragment.from(itemsSelected)
|
|
166
|
-
);
|
|
167
|
-
tr = tr.insert(pos, Fragment.from(listNodeNew));
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
if (itemsBefore.length) {
|
|
171
|
-
const listNodeNew = listNodeType.create(
|
|
172
|
-
listNode.attrs,
|
|
173
|
-
Fragment.from(itemsBefore)
|
|
174
|
-
);
|
|
175
|
-
tr = tr.insert(pos, Fragment.from(listNodeNew));
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return tr;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
function setNodeIndentMarkup(
|
|
182
|
-
state: EditorState,
|
|
183
|
-
tr: Transform,
|
|
184
|
-
pos: number,
|
|
185
|
-
delta: number,
|
|
186
|
-
view: EditorView
|
|
187
|
-
): Transform {
|
|
188
|
-
const retVal = true;
|
|
189
|
-
if (!tr.doc) {
|
|
190
|
-
return tr;
|
|
191
|
-
}
|
|
192
|
-
const node = tr.doc.nodeAt(pos);
|
|
193
|
-
if (!node) {
|
|
194
|
-
return { tr, docChanged: retVal };
|
|
195
|
-
}
|
|
196
|
-
const indent = clamp(
|
|
197
|
-
MIN_INDENT_LEVEL,
|
|
198
|
-
(node.attrs.indent || 0) + delta,
|
|
199
|
-
MAX_INDENT_LEVEL
|
|
200
|
-
);
|
|
201
|
-
|
|
202
|
-
if (indent === node.attrs.indent) {
|
|
203
|
-
return { tr, docChanged: false };
|
|
204
|
-
}
|
|
205
|
-
const nodeAttrs = {
|
|
206
|
-
...node.attrs,
|
|
207
|
-
indent,
|
|
208
|
-
};
|
|
209
|
-
tr = tr.setNodeMarkup(pos, node.type, nodeAttrs, node.marks);
|
|
210
|
-
return { tr, docChanged: true };
|
|
211
|
-
}
|