@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/EditorCommands.js
CHANGED
|
@@ -5,20 +5,20 @@ import * as ProsemirrorTables from 'prosemirror-tables';
|
|
|
5
5
|
// import BlockquoteInsertNewLineCommand from './BlockquoteInsertNewLineCommand';
|
|
6
6
|
// import BlockquoteToggleCommand from './BlockquoteToggleCommand';
|
|
7
7
|
import DocLayoutCommand from './DocLayoutCommand';
|
|
8
|
-
import HeadingCommand from '
|
|
8
|
+
import { HeadingCommand } from '@modusoperandi/licit-ui-commands';
|
|
9
9
|
import HistoryRedoCommand from './HistoryRedoCommand';
|
|
10
10
|
import HistoryUndoCommand from './HistoryUndoCommand';
|
|
11
11
|
import HorizontalRuleCommand from './HorizontalRuleCommand';
|
|
12
12
|
import ImageFromURLCommand from './ImageFromURLCommand';
|
|
13
13
|
import ImageUploadCommand from './ImageUploadCommand';
|
|
14
|
-
import IndentCommand from '
|
|
14
|
+
import { IndentCommand } from '@modusoperandi/licit-ui-commands';
|
|
15
15
|
import LinkSetURLCommand from './LinkSetURLCommand';
|
|
16
16
|
import ListItemInsertNewLineCommand from './ListItemInsertNewLineCommand';
|
|
17
17
|
import ListItemMergeCommand from './ListItemMergeCommand';
|
|
18
18
|
import ListSplitCommand from './ListSplitCommand';
|
|
19
19
|
import { ListToggleCommand } from './ListToggleCommand';
|
|
20
20
|
import * as MarkNames from './MarkNames';
|
|
21
|
-
import MarkToggleCommand from '
|
|
21
|
+
import { MarkToggleCommand } from '@modusoperandi/licit-ui-commands';
|
|
22
22
|
import MarksClearCommand from './MarksClearCommand';
|
|
23
23
|
import MathEditCommand from './MathEditCommand';
|
|
24
24
|
import PrintCommand from './PrintCommand';
|
|
@@ -26,11 +26,11 @@ import TableBackgroundColorCommand from './TableBackgroundColorCommand';
|
|
|
26
26
|
import TableBorderColorCommand from './TableBorderColorCommand';
|
|
27
27
|
import TableInsertCommand from './TableInsertCommand';
|
|
28
28
|
import TableMergeCellsCommand from './TableMergeCellsCommand';
|
|
29
|
-
import TextAlignCommand from '
|
|
30
|
-
import TextColorCommand from '
|
|
31
|
-
import TextHighlightCommand from '
|
|
29
|
+
import { TextAlignCommand } from '@modusoperandi/licit-ui-commands';
|
|
30
|
+
import { TextColorCommand } from '@modusoperandi/licit-ui-commands';
|
|
31
|
+
import { TextHighlightCommand } from '@modusoperandi/licit-ui-commands';
|
|
32
32
|
import TextInsertTabSpaceCommand from './TextInsertTabSpaceCommand';
|
|
33
|
-
import TextLineSpacingCommand from '
|
|
33
|
+
import { TextLineSpacingCommand } from '@modusoperandi/licit-ui-commands';
|
|
34
34
|
import createCommand from './createCommand';
|
|
35
35
|
|
|
36
36
|
const {
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from './CursorPlaceholderPlugin';
|
|
13
13
|
import { IMAGE } from './NodeNames';
|
|
14
14
|
import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
|
|
15
|
-
import createPopUp from '
|
|
15
|
+
import { createPopUp } from '@modusoperandi/licit-ui-commands';
|
|
16
16
|
|
|
17
17
|
import type { ImageLike } from './Types';
|
|
18
18
|
|
package/src/LinkSetURLCommand.js
CHANGED
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
hideSelectionPlaceholder,
|
|
11
11
|
showSelectionPlaceholder,
|
|
12
12
|
} from './SelectionPlaceholderPlugin';
|
|
13
|
-
import applyMark from '
|
|
14
|
-
import findNodesWithSameMark from '
|
|
13
|
+
import { applyMark } from '@modusoperandi/licit-ui-commands';
|
|
14
|
+
import { findNodesWithSameMark } from '@modusoperandi/licit-ui-commands';
|
|
15
15
|
import LinkURLEditor from './ui/LinkURLEditor';
|
|
16
16
|
import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
|
|
17
|
-
import createPopUp from '
|
|
17
|
+
import { createPopUp } from '@modusoperandi/licit-ui-commands';
|
|
18
18
|
|
|
19
19
|
class LinkSetURLCommand extends UICommand {
|
|
20
20
|
_popUp = null;
|
package/src/LinkTooltipPlugin.js
CHANGED
|
@@ -9,15 +9,15 @@ import {
|
|
|
9
9
|
hideSelectionPlaceholder,
|
|
10
10
|
showSelectionPlaceholder,
|
|
11
11
|
} from './SelectionPlaceholderPlugin';
|
|
12
|
-
import applyMark from '
|
|
13
|
-
import findNodesWithSameMark from '
|
|
12
|
+
import { applyMark } from '@modusoperandi/licit-ui-commands';
|
|
13
|
+
import { findNodesWithSameMark } from '@modusoperandi/licit-ui-commands';
|
|
14
14
|
import lookUpElement from './lookUpElement';
|
|
15
15
|
import LinkTooltip from './ui/LinkTooltip';
|
|
16
16
|
import LinkURLEditor from './ui/LinkURLEditor';
|
|
17
|
-
import { atAnchorTopCenter } from '
|
|
18
|
-
import createPopUp from '
|
|
17
|
+
import { atAnchorTopCenter } from '@modusoperandi/licit-ui-commands';
|
|
18
|
+
import { createPopUp } from '@modusoperandi/licit-ui-commands';
|
|
19
19
|
|
|
20
|
-
import '
|
|
20
|
+
import '@modusoperandi/licit-ui-commands/dist/ui/czi-pop-up.css';
|
|
21
21
|
|
|
22
22
|
// https://prosemirror.net/examples/tooltip/
|
|
23
23
|
const SPEC = {
|
package/src/ListToggleCommand.js
CHANGED
|
@@ -6,10 +6,10 @@ import { findParentNodeOfType } from 'prosemirror-utils';
|
|
|
6
6
|
import { EditorView } from 'prosemirror-view';
|
|
7
7
|
|
|
8
8
|
import { BULLET_LIST, ORDERED_LIST, IMAGE } from './NodeNames';
|
|
9
|
-
import noop from '
|
|
10
|
-
import toggleList from '
|
|
9
|
+
import { noop } from '@modusoperandi/licit-ui-commands';
|
|
10
|
+
import { toggleList } from '@modusoperandi/licit-ui-commands';
|
|
11
11
|
import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
|
|
12
|
-
import isNodeSelectionForNodeType from '
|
|
12
|
+
import { isNodeSelectionForNodeType } from '@modusoperandi/licit-ui-commands';
|
|
13
13
|
|
|
14
14
|
export class ListToggleCommand extends UICommand {
|
|
15
15
|
_ordered: boolean;
|
package/src/MarksClearCommand.js
CHANGED
|
@@ -4,7 +4,7 @@ import { EditorState, AllSelection, TextSelection } from 'prosemirror-state';
|
|
|
4
4
|
import { Transform } from 'prosemirror-transform';
|
|
5
5
|
import { EditorView } from 'prosemirror-view';
|
|
6
6
|
|
|
7
|
-
import { clearMarks, clearHeading } from '
|
|
7
|
+
import { clearMarks, clearHeading } from '@modusoperandi/licit-ui-commands';
|
|
8
8
|
import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
|
|
9
9
|
|
|
10
10
|
class MarksClearCommand extends UICommand {
|
package/src/MathEditCommand.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import { MATH } from './NodeNames';
|
|
16
16
|
import MathEditor from './ui/MathEditor';
|
|
17
17
|
import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
|
|
18
|
-
import createPopUp from '
|
|
18
|
+
import { createPopUp } from '@modusoperandi/licit-ui-commands';
|
|
19
19
|
|
|
20
20
|
function insertMath(tr: Transform, schema: Schema, latex: ?string): Transform {
|
|
21
21
|
const { selection } = tr;
|
package/src/ParagraphNodeSpec.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import convertToCSSPTValue from './convertToCSSPTValue';
|
|
4
4
|
import toCSSLineSpacing from './ui/toCSSLineSpacing';
|
|
5
5
|
import { Node } from 'prosemirror-model';
|
|
@@ -150,11 +150,7 @@ export const getParagraphStyle = getStyle;
|
|
|
150
150
|
|
|
151
151
|
export function convertMarginLeftToIndentValue(marginLeft: string): number {
|
|
152
152
|
const ptValue = convertToCSSPTValue(marginLeft);
|
|
153
|
-
return
|
|
154
|
-
MIN_INDENT_LEVEL,
|
|
155
|
-
Math.floor(ptValue / INDENT_MARGIN_PT_SIZE),
|
|
156
|
-
MAX_INDENT_LEVEL
|
|
157
|
-
);
|
|
153
|
+
return Math.min(Math.max(Math.floor(ptValue / INDENT_MARGIN_PT_SIZE), MIN_INDENT_LEVEL), MAX_INDENT_LEVEL);
|
|
158
154
|
}
|
|
159
155
|
|
|
160
156
|
export default ParagraphNodeSpec;
|
|
@@ -6,10 +6,10 @@ import { setCellAttr } from 'prosemirror-tables';
|
|
|
6
6
|
import { Transform } from 'prosemirror-transform';
|
|
7
7
|
import { EditorView } from 'prosemirror-view';
|
|
8
8
|
|
|
9
|
-
import ColorEditor from '
|
|
10
|
-
import { atAnchorRight } from '
|
|
9
|
+
import { ColorEditor } from '@modusoperandi/licit-ui-commands';
|
|
10
|
+
import { atAnchorRight } from '@modusoperandi/licit-ui-commands';
|
|
11
11
|
import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
|
|
12
|
-
import createPopUp from '
|
|
12
|
+
import { createPopUp } from '@modusoperandi/licit-ui-commands';
|
|
13
13
|
|
|
14
14
|
const setCellBackgroundBlack = setCellAttr('background', '#000000');
|
|
15
15
|
|
|
@@ -6,10 +6,10 @@ import { setCellAttr } from 'prosemirror-tables';
|
|
|
6
6
|
import { Transform } from 'prosemirror-transform';
|
|
7
7
|
import { EditorView } from 'prosemirror-view';
|
|
8
8
|
|
|
9
|
-
import ColorEditor from '
|
|
10
|
-
import { atAnchorRight } from '
|
|
9
|
+
import { ColorEditor } from '@modusoperandi/licit-ui-commands';
|
|
10
|
+
import { atAnchorRight } from '@modusoperandi/licit-ui-commands';
|
|
11
11
|
import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
|
|
12
|
-
import createPopUp from '
|
|
12
|
+
import { createPopUp } from '@modusoperandi/licit-ui-commands';
|
|
13
13
|
|
|
14
14
|
const setCellBorderBlack = setCellAttr('borderColor', '#000000');
|
|
15
15
|
|
|
@@ -6,10 +6,10 @@ import { setCellAttr } from 'prosemirror-tables';
|
|
|
6
6
|
import { Transform } from 'prosemirror-transform';
|
|
7
7
|
import { EditorView } from 'prosemirror-view';
|
|
8
8
|
|
|
9
|
-
import ColorEditor from '
|
|
10
|
-
import { atAnchorRight } from '
|
|
9
|
+
import { ColorEditor } from '@modusoperandi/licit-ui-commands';
|
|
10
|
+
import { atAnchorRight } from '@modusoperandi/licit-ui-commands';
|
|
11
11
|
import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
|
|
12
|
-
import createPopUp from '
|
|
12
|
+
import { createPopUp } from '@modusoperandi/licit-ui-commands';
|
|
13
13
|
|
|
14
14
|
const setCellBackgroundBlack = setCellAttr('background', '#000000');
|
|
15
15
|
|
|
@@ -6,13 +6,13 @@ import { EditorView } from 'prosemirror-view';
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
|
|
8
8
|
import findActionableCell from './findActionableCell';
|
|
9
|
-
import { atAnchorTopRight } from '
|
|
9
|
+
import { atAnchorTopRight } from '@modusoperandi/licit-ui-commands';
|
|
10
10
|
import TableCellMenu from './ui/TableCellMenu';
|
|
11
11
|
import bindScrollHandler from './ui/bindScrollHandler';
|
|
12
|
-
import createPopUp from '
|
|
12
|
+
import { createPopUp } from '@modusoperandi/licit-ui-commands';
|
|
13
13
|
import isElementFullyVisible from './ui/isElementFullyVisible';
|
|
14
14
|
|
|
15
|
-
import '
|
|
15
|
+
import '@modusoperandi/licit-ui-commands/dist/ui/czi-pop-up.css';
|
|
16
16
|
|
|
17
17
|
class TableCellTooltipView {
|
|
18
18
|
_cellElement: null;
|
|
@@ -7,10 +7,10 @@ import { Transform } from 'prosemirror-transform';
|
|
|
7
7
|
import { EditorView } from 'prosemirror-view';
|
|
8
8
|
import { Fragment } from 'prosemirror-model';
|
|
9
9
|
import insertTable from './insertTable';
|
|
10
|
-
import { atAnchorRight } from '
|
|
10
|
+
import { atAnchorRight } from '@modusoperandi/licit-ui-commands';
|
|
11
11
|
import TableGridSizeEditor from './ui/TableGridSizeEditor';
|
|
12
12
|
import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
|
|
13
|
-
import createPopUp from '
|
|
13
|
+
import { createPopUp } from '@modusoperandi/licit-ui-commands';
|
|
14
14
|
import { PARAGRAPH } from './NodeNames';
|
|
15
15
|
import type { TableGridSizeEditorValue } from './ui/TableGridSizeEditor';
|
|
16
16
|
|
|
@@ -8,7 +8,7 @@ import { EditorView } from 'prosemirror-view';
|
|
|
8
8
|
import { MARK_SPACER } from './MarkNames';
|
|
9
9
|
import { HEADING, LIST_ITEM, PARAGRAPH } from './NodeNames';
|
|
10
10
|
import { HAIR_SPACE_CHAR, SPACER_SIZE_TAB } from './SpacerMarkSpec';
|
|
11
|
-
import applyMark from '
|
|
11
|
+
import { applyMark } from '@modusoperandi/licit-ui-commands';
|
|
12
12
|
import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
|
|
13
13
|
|
|
14
14
|
function insertTabSpace(
|
|
@@ -51,6 +51,21 @@ class CollabConnector extends SimpleConnector {
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
cleanUp = () => {
|
|
55
|
+
// remove collab plugin
|
|
56
|
+
if (this._connection) {
|
|
57
|
+
const cpIdx = this._editorState.plugins.findIndex((plugin) => {
|
|
58
|
+
return 'collab$' === plugin.spec.key.key;
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
if (-1 != cpIdx) {
|
|
62
|
+
this._editorState.plugins.splice(cpIdx, 1);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
this._connection.close();
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
54
69
|
onEdit = (transaction: Transform): void => {
|
|
55
70
|
if (!this._connection.ready) {
|
|
56
71
|
console.warn('not ready');
|
|
@@ -63,8 +78,8 @@ class CollabConnector extends SimpleConnector {
|
|
|
63
78
|
|
|
64
79
|
// FS IRAD-1040 2020-09-02
|
|
65
80
|
// Send the modified schema to server
|
|
66
|
-
updateSchema = (schema: Schema) => {
|
|
67
|
-
this._connection.updateSchema(schema);
|
|
81
|
+
updateSchema = (schema: Schema, data: any) => {
|
|
82
|
+
this._connection.updateSchema(schema, data);
|
|
68
83
|
};
|
|
69
84
|
}
|
|
70
85
|
|
|
@@ -106,7 +106,7 @@ class EditorConnection {
|
|
|
106
106
|
|
|
107
107
|
if (newEditState) {
|
|
108
108
|
let sendable;
|
|
109
|
-
if (newEditState.doc.content.size >
|
|
109
|
+
if (newEditState.doc.content.size > 4000000000000) {
|
|
110
110
|
if (this.state.comm !== 'detached') {
|
|
111
111
|
this.report.failure('Document too big. Detached.');
|
|
112
112
|
}
|
|
@@ -132,6 +132,17 @@ class EditorConnection {
|
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
134
|
|
|
135
|
+
dispatchData(data: any) {
|
|
136
|
+
this.report.success();
|
|
137
|
+
this.backOff = 0;
|
|
138
|
+
this.dispatch({
|
|
139
|
+
type: 'loaded',
|
|
140
|
+
doc: this.getEffectiveSchema().nodeFromJSON(data),
|
|
141
|
+
version: data.version,
|
|
142
|
+
users: data.users,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
135
146
|
// Load the document from the server and start up
|
|
136
147
|
start(): void {
|
|
137
148
|
this.run(GET(this.url)).then(
|
|
@@ -242,7 +253,7 @@ class EditorConnection {
|
|
|
242
253
|
|
|
243
254
|
// [FS] IRAD-1040 2020-09-02
|
|
244
255
|
// Send the modified schema to server
|
|
245
|
-
updateSchema(schema: Schema) {
|
|
256
|
+
updateSchema(schema: Schema, input: any) {
|
|
246
257
|
// to avoid cyclic reference error, use flatted string.
|
|
247
258
|
const schemaFlatted = stringify(schema);
|
|
248
259
|
this.run(POST(this.url + '/schema/', schemaFlatted, 'text/plain')).then(
|
|
@@ -250,7 +261,7 @@ class EditorConnection {
|
|
|
250
261
|
console.log("collab server's schema updated");
|
|
251
262
|
// [FS] IRAD-1040 2020-09-08
|
|
252
263
|
this.schema = schema;
|
|
253
|
-
this.start();
|
|
264
|
+
this.start(input);
|
|
254
265
|
},
|
|
255
266
|
(err) => {
|
|
256
267
|
this.report.failure(err);
|
package/src/client/Licit.js
CHANGED
|
@@ -14,8 +14,8 @@ import SimpleConnector from './SimpleConnector';
|
|
|
14
14
|
import CollabConnector from './CollabConnector';
|
|
15
15
|
import { EMPTY_DOC_JSON } from '../createEmptyEditorState';
|
|
16
16
|
import type { EditorRuntime } from '../Types';
|
|
17
|
-
import createPopUp from '
|
|
18
|
-
import { atViewportCenter } from '
|
|
17
|
+
import { createPopUp } from '@modusoperandi/licit-ui-commands';
|
|
18
|
+
import { atViewportCenter } from '@modusoperandi/licit-ui-commands';
|
|
19
19
|
import AlertInfo from '../ui/AlertInfo';
|
|
20
20
|
import { SetDocAttrStep } from '@modusoperandi/licit-doc-attrs-step';
|
|
21
21
|
import './licit.css';
|
|
@@ -73,7 +73,7 @@ class Licit extends React.Component<any, any> {
|
|
|
73
73
|
this._editorView = null;
|
|
74
74
|
this._skipSCU = true;
|
|
75
75
|
|
|
76
|
-
const noop = function () {
|
|
76
|
+
const noop = function () {};
|
|
77
77
|
|
|
78
78
|
// [FS] IRAD-981 2020-06-10
|
|
79
79
|
// Component's configurations.
|
|
@@ -132,17 +132,17 @@ class Licit extends React.Component<any, any> {
|
|
|
132
132
|
const setState = this.setState.bind(this);
|
|
133
133
|
this._connector = collaborative
|
|
134
134
|
? new CollabConnector(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
135
|
+
editorState,
|
|
136
|
+
setState,
|
|
137
|
+
{
|
|
138
|
+
docID,
|
|
139
|
+
collabServiceURL,
|
|
140
|
+
},
|
|
141
|
+
this._defaultEditorSchema,
|
|
142
|
+
this._defaultEditorPlugins,
|
|
143
|
+
// [FS] IRAD-1578 2021-09-27
|
|
144
|
+
this.onReady.bind(this)
|
|
145
|
+
)
|
|
146
146
|
: new SimpleConnector(editorState, setState);
|
|
147
147
|
|
|
148
148
|
// FS IRAD-989 2020-18-06
|
|
@@ -168,7 +168,7 @@ class Licit extends React.Component<any, any> {
|
|
|
168
168
|
// Get the modified schema from editorstate and send it to collab server
|
|
169
169
|
if (this._connector.updateSchema) {
|
|
170
170
|
// Use known editorState to update schema.
|
|
171
|
-
this._connector.updateSchema(editorState.schema);
|
|
171
|
+
this._connector.updateSchema(editorState.schema, data);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
|
@@ -265,12 +265,16 @@ class Licit extends React.Component<any, any> {
|
|
|
265
265
|
|
|
266
266
|
setContent = (content: any = {}): void => {
|
|
267
267
|
// [FS] IRAD-1571 2021-09-27
|
|
268
|
-
// dispatch a transaction that MUST start from the view
|
|
268
|
+
// dispatch a transaction that MUST start from the views current state;
|
|
269
269
|
const editorState = this._editorView.state;
|
|
270
270
|
const { doc, schema } = editorState;
|
|
271
271
|
let { tr } = editorState;
|
|
272
272
|
const document = schema.nodeFromJSON(content ? content : EMPTY_DOC_JSON);
|
|
273
273
|
|
|
274
|
+
// [FS] IRAD-1593 2021-10-12
|
|
275
|
+
// Reset lastKeyCode since the content is set dynamically and so lastKeyCode is invalid now.
|
|
276
|
+
this._editorView.lastKeyCode = null;
|
|
277
|
+
|
|
274
278
|
const selection = TextSelection.create(doc, 0, doc.content.size);
|
|
275
279
|
|
|
276
280
|
tr = tr.setSelection(selection).replaceSelectionWith(document, false);
|
|
@@ -278,8 +282,8 @@ class Licit extends React.Component<any, any> {
|
|
|
278
282
|
// set the value for object metadata and objectId
|
|
279
283
|
tr = this.isNodeHasAttribute(document, ATTR_OBJMETADATA)
|
|
280
284
|
? tr.step(
|
|
281
|
-
|
|
282
|
-
|
|
285
|
+
new SetDocAttrStep(ATTR_OBJMETADATA, document.attrs.objectMetaData)
|
|
286
|
+
)
|
|
283
287
|
: tr;
|
|
284
288
|
tr = this.isNodeHasAttribute(document, ATTR_OBJID)
|
|
285
289
|
? tr.step(new SetDocAttrStep(ATTR_OBJID, document.attrs.objectId))
|
|
@@ -289,58 +293,84 @@ class Licit extends React.Component<any, any> {
|
|
|
289
293
|
this._editorView.dispatch(tr);
|
|
290
294
|
};
|
|
291
295
|
|
|
296
|
+
hasDataChanged(nextData: any) {
|
|
297
|
+
let dataChanged = false;
|
|
298
|
+
|
|
299
|
+
// [FS] IRAD-1571 2021-09-27
|
|
300
|
+
// dispatch a transaction that MUST start from the views current state;
|
|
301
|
+
// [FS] IRAD-1589 2021-10-04
|
|
302
|
+
// Do a proper circular JSON comparison.
|
|
303
|
+
if (stringify(this.state.data) !== stringify(nextData)) {
|
|
304
|
+
const editorState = this._editorView.state;
|
|
305
|
+
const nextDoc = editorState.schema.nodeFromJSON(
|
|
306
|
+
nextData ? nextData : EMPTY_DOC_JSON
|
|
307
|
+
);
|
|
308
|
+
dataChanged = !nextDoc.eq(editorState.doc);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
return dataChanged;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
changeContent(data: any) {
|
|
315
|
+
if (this.hasDataChanged(data)) {
|
|
316
|
+
// FS IRAD-1592 2021-11-10
|
|
317
|
+
// Release here quickly, so that update doesn't care about at this point.
|
|
318
|
+
// data changed, so update document content
|
|
319
|
+
setTimeout(this.setContent.bind(this, data), 1);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
292
323
|
shouldComponentUpdate(nextProps: any, nextState: any) {
|
|
293
324
|
// Only interested if properties are set from outside.
|
|
294
325
|
if (!this._skipSCU) {
|
|
295
326
|
this._skipSCU = false;
|
|
296
|
-
let dataChanged = false;
|
|
297
|
-
|
|
298
|
-
// [FS] IRAD-1571 2021-09-27
|
|
299
|
-
// dispatch a transaction that MUST start from the view�s current state;
|
|
300
|
-
// [FS] IRAD-1589 2021-10-04
|
|
301
|
-
// Do a proper circular JSON comparison.
|
|
302
|
-
if (stringify(this.state.data) !== stringify(nextState.data)) {
|
|
303
|
-
const editorState = this._editorView.state;
|
|
304
|
-
const nextDoc = editorState.schema.nodeFromJSON(
|
|
305
|
-
nextState.data ? nextState.data : EMPTY_DOC_JSON
|
|
306
|
-
);
|
|
307
|
-
dataChanged = !nextDoc.eq(editorState.doc);
|
|
308
|
-
}
|
|
309
327
|
|
|
310
|
-
|
|
311
|
-
// data changed, so update document content
|
|
312
|
-
this.setContent(nextState.data);
|
|
313
|
-
}
|
|
328
|
+
this.changeContent(nextState.data);
|
|
314
329
|
|
|
315
330
|
if (this.state.docID !== nextState.docID) {
|
|
316
|
-
|
|
317
|
-
const collabEditing = nextState.docID !== '';
|
|
318
|
-
const editorState = this._editorView.state;
|
|
319
|
-
const setState = this.setState.bind(this);
|
|
320
|
-
const docID = nextState.docID || '';
|
|
321
|
-
const collabServiceURL =
|
|
322
|
-
nextState.collabServiceURL || '/collaboration-service';
|
|
323
|
-
// create new connector
|
|
324
|
-
this._connector = collabEditing
|
|
325
|
-
? new CollabConnector(
|
|
326
|
-
editorState,
|
|
327
|
-
setState,
|
|
328
|
-
{
|
|
329
|
-
docID,
|
|
330
|
-
collabServiceURL,
|
|
331
|
-
},
|
|
332
|
-
this._defaultEditorSchema,
|
|
333
|
-
this._defaultEditorPlugins,
|
|
334
|
-
// [FS] IRAD-1578 2021-09-27
|
|
335
|
-
this.onReady.bind(this)
|
|
336
|
-
)
|
|
337
|
-
: new SimpleConnector(editorState, setState);
|
|
331
|
+
setTimeout(this.setDocID.bind(this, nextState), 1);
|
|
338
332
|
}
|
|
339
333
|
}
|
|
340
334
|
|
|
341
335
|
return true;
|
|
342
336
|
}
|
|
343
337
|
|
|
338
|
+
setDocID(nextState: any) {
|
|
339
|
+
// Collaborative mode changed
|
|
340
|
+
const collabEditing = nextState.docID !== '';
|
|
341
|
+
const editorState = this._editorView.state;
|
|
342
|
+
const setState = this.setState.bind(this);
|
|
343
|
+
const docID = nextState.docID || '';
|
|
344
|
+
const collabServiceURL =
|
|
345
|
+
nextState.collabServiceURL || '/collaboration-service';
|
|
346
|
+
|
|
347
|
+
if (this._connector) {
|
|
348
|
+
this._connector.cleanUp();
|
|
349
|
+
}
|
|
350
|
+
// create new connector
|
|
351
|
+
this._connector = collabEditing
|
|
352
|
+
? new CollabConnector(
|
|
353
|
+
editorState,
|
|
354
|
+
setState,
|
|
355
|
+
{
|
|
356
|
+
docID,
|
|
357
|
+
collabServiceURL,
|
|
358
|
+
},
|
|
359
|
+
this._defaultEditorSchema,
|
|
360
|
+
this._defaultEditorPlugins,
|
|
361
|
+
// [FS] IRAD-1578 2021-09-27
|
|
362
|
+
this.onReady.bind(this)
|
|
363
|
+
)
|
|
364
|
+
: new SimpleConnector(editorState, setState);
|
|
365
|
+
|
|
366
|
+
// FS IRAD-1592 2021-11-10
|
|
367
|
+
// Notify collab server
|
|
368
|
+
if (this._connector.updateSchema) {
|
|
369
|
+
// Use known editorState to update schema.
|
|
370
|
+
this._connector.updateSchema(editorState.schema);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
344
374
|
render(): React.Element<any> {
|
|
345
375
|
const {
|
|
346
376
|
editorState,
|
|
@@ -401,7 +431,18 @@ class Licit extends React.Component<any, any> {
|
|
|
401
431
|
|
|
402
432
|
if (transaction.docChanged) {
|
|
403
433
|
const docJson = transaction.doc.toJSON();
|
|
404
|
-
|
|
434
|
+
let isEmpty = false;
|
|
435
|
+
|
|
436
|
+
if (docJson.content && docJson.content.length === 1) {
|
|
437
|
+
if (
|
|
438
|
+
!docJson.content[0].content ||
|
|
439
|
+
(docJson.content[0].content &&
|
|
440
|
+
docJson.content[0].content[0].text &&
|
|
441
|
+
'' === docJson.content[0].content[0].text.trim())
|
|
442
|
+
) {
|
|
443
|
+
isEmpty = true;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
405
446
|
|
|
406
447
|
// setCFlags is/was always the opposite of isEmpty.
|
|
407
448
|
if (isEmpty) {
|
|
@@ -419,27 +460,6 @@ class Licit extends React.Component<any, any> {
|
|
|
419
460
|
}
|
|
420
461
|
}
|
|
421
462
|
};
|
|
422
|
-
|
|
423
|
-
isDocEmpty(docJson: Object) {
|
|
424
|
-
let isEmpty = false;
|
|
425
|
-
|
|
426
|
-
if (docJson.content && docJson.content.length === 1) {
|
|
427
|
-
if (
|
|
428
|
-
!docJson.content[0].content ||
|
|
429
|
-
(docJson.content[0].content &&
|
|
430
|
-
// [FS] IRAD-1710 2022-03-04
|
|
431
|
-
// Empty if no content OR when the one & only text content is empty.
|
|
432
|
-
1 === docJson.content[0].content.length &&
|
|
433
|
-
'text' === docJson.content[0].content[0].type &&
|
|
434
|
-
docJson.content[0].content[0].text &&
|
|
435
|
-
'' === docJson.content[0].content[0].text)
|
|
436
|
-
) {
|
|
437
|
-
isEmpty = true;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
return isEmpty;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
463
|
// [FS] IRAD-1173 2021-02-25
|
|
444
464
|
// Bug fix: Transaction mismatch error when a dialog is opened and keep typing.
|
|
445
465
|
closeOpenedPopupModels() {
|
|
@@ -456,12 +476,8 @@ class Licit extends React.Component<any, any> {
|
|
|
456
476
|
this._editorView = editorView;
|
|
457
477
|
const tr = state.tr;
|
|
458
478
|
const doc = state.doc;
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
if (!this.isDocEmpty(doc.toJSON())) {
|
|
462
|
-
const trx = tr.setSelection(TextSelection.create(doc, 0, doc.content.size));
|
|
463
|
-
dispatch(trx.scrollIntoView());
|
|
464
|
-
}
|
|
479
|
+
const trx = tr.setSelection(TextSelection.create(doc, 0, doc.content.size));
|
|
480
|
+
dispatch(trx.scrollIntoView());
|
|
465
481
|
|
|
466
482
|
// [FS] IRAD-1578 2021-09-27
|
|
467
483
|
// In collab mode, fire onRead only after getting the response from collab server.
|
package/src/client/Licit.test.js
CHANGED
|
@@ -3,7 +3,7 @@ import { configure, shallow } from 'enzyme';
|
|
|
3
3
|
import Adapter from 'enzyme-adapter-react-16';
|
|
4
4
|
import Licit from './Licit';
|
|
5
5
|
import RichTextEditor from '../ui/RichTextEditor';
|
|
6
|
-
import noop from '
|
|
6
|
+
import { noop } from '@modusoperandi/licit-ui-commands';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Configure Jest to use react / enzyme
|
|
@@ -16,6 +16,17 @@ describe('<Licit />', () => {
|
|
|
16
16
|
let wrapper;
|
|
17
17
|
let licit;
|
|
18
18
|
|
|
19
|
+
// provide an empty document just to shut up that warning
|
|
20
|
+
const data = {
|
|
21
|
+
type: 'doc',
|
|
22
|
+
content: [
|
|
23
|
+
{
|
|
24
|
+
type: 'paragraph',
|
|
25
|
+
content: [{ type: 'text', text: ' ' }],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
|
|
19
30
|
// Mocking the functions used in _onReady
|
|
20
31
|
const fakeEditorView = {
|
|
21
32
|
focus: noop,
|
|
@@ -24,6 +35,7 @@ describe('<Licit />', () => {
|
|
|
24
35
|
doc: {
|
|
25
36
|
content: { size: 10 },
|
|
26
37
|
resolve: () => ({ min: () => 0, max: () => 10 }),
|
|
38
|
+
toJSON: () => data,
|
|
27
39
|
},
|
|
28
40
|
tr: {
|
|
29
41
|
setSelection: () => fakeEditorView.state.tr,
|
|
@@ -33,16 +45,6 @@ describe('<Licit />', () => {
|
|
|
33
45
|
};
|
|
34
46
|
|
|
35
47
|
beforeEach(() => {
|
|
36
|
-
// provide an empty document just to shut up that warning
|
|
37
|
-
const data = {
|
|
38
|
-
type: 'doc',
|
|
39
|
-
content: [
|
|
40
|
-
{
|
|
41
|
-
type: 'paragraph',
|
|
42
|
-
content: [{ type: 'text', text: ' ' }],
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
};
|
|
46
48
|
wrapper = shallow(<Licit data={data} />);
|
|
47
49
|
licit = wrapper.instance();
|
|
48
50
|
});
|
|
@@ -47,7 +47,9 @@ class SimpleConnector {
|
|
|
47
47
|
|
|
48
48
|
// FS IRAD-1040 2020-09-02
|
|
49
49
|
// Send the modified schema to server
|
|
50
|
-
updateSchema = (schema: Schema) => {};
|
|
50
|
+
updateSchema = (schema: Schema, data: any) => {};
|
|
51
|
+
|
|
52
|
+
cleanUp = () => {};
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
export default SimpleConnector;
|
package/src/joinListNode.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Schema } from 'prosemirror-model';
|
|
|
4
4
|
import { TextSelection } from 'prosemirror-state';
|
|
5
5
|
import { Transform } from 'prosemirror-transform';
|
|
6
6
|
|
|
7
|
-
import isListNode from '
|
|
7
|
+
import { isListNode } from '@modusoperandi/licit-ui-commands';
|
|
8
8
|
import joinDown from './joinDown';
|
|
9
9
|
import joinUp from './joinUp';
|
|
10
10
|
|