@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import stable from 'stable';
|
|
4
4
|
import toCSSColor from './ui/toCSSColor';
|
|
5
|
-
import toCSSLineSpacing from '
|
|
5
|
+
import { toCSSLineSpacing } from '@modusoperandi/licit-ui-commands';
|
|
6
6
|
|
|
7
7
|
const LIST_ITEM_PSEUDO_ELEMENT_BEFORE = /li:+before/;
|
|
8
8
|
const NODE_NAME_SELECTOR = /^[a-zA-Z]+\d*$/;
|
package/src/styles.css
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
@import './styles0.css';
|
|
2
2
|
@import './ui/czi-loading-indicator.css';
|
|
3
3
|
@import './ui/czi-math-view.css';
|
|
4
|
-
@import '
|
|
4
|
+
@import '@modusoperandi/licit-ui-commands/dist/ui/czi-pop-up.css';
|
|
5
5
|
@import './ui/czi-selection-placeholder.css';
|
|
6
6
|
@import './ui/czi-table-cell-menu.css';
|
|
7
7
|
@import './ui/czi-table-grid-size-editor.css';
|
|
8
|
-
@import '
|
|
8
|
+
@import '@modusoperandi/licit-ui-commands/dist/ui/czi-tooltip-surface.css';
|
|
9
9
|
@import './ui/mathquill-editor/czi-mathquill-editor.css';
|
|
10
10
|
@import './ui/mathquill-editor/czi-mathquill-editor-symbols-panel.css';
|
|
11
11
|
@import './client/licit.css';
|
package/src/styles0.css
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
@import './ui/czi-indent.css';
|
|
4
4
|
@import './ui/czi-list.css';
|
|
5
5
|
@import './ui/czi-table.css';
|
|
6
|
-
@import '
|
|
7
|
-
@import '
|
|
8
|
-
@import '
|
|
6
|
+
@import '@modusoperandi/licit-ui-commands/dist/ui/czi-custom-button.css';
|
|
7
|
+
@import '@modusoperandi/licit-ui-commands/dist/ui/czi-animations.css';
|
|
8
|
+
@import '@modusoperandi/licit-ui-commands/dist/ui/czi-color-editor.css';
|
|
9
9
|
@import './ui/czi-bookmark-view.css';
|
|
10
10
|
@import './ui/czi-body-layout-editor.css';
|
|
11
11
|
@import './ui/czi-cursor-placeholder.css';
|
package/src/toggleBlockquote.js
CHANGED
|
@@ -4,10 +4,10 @@ import { Schema } from 'prosemirror-model';
|
|
|
4
4
|
import { Transform } from 'prosemirror-transform';
|
|
5
5
|
|
|
6
6
|
import { BLOCKQUOTE, HEADING, LIST_ITEM, PARAGRAPH } from './NodeNames';
|
|
7
|
-
import compareNumber from '
|
|
8
|
-
import isInsideListItem from '
|
|
9
|
-
import isListNode from '
|
|
10
|
-
import { unwrapNodesFromList } from '
|
|
7
|
+
import { compareNumber } from '@modusoperandi/licit-ui-commands';
|
|
8
|
+
import { isInsideListItem } from '@modusoperandi/licit-ui-commands';
|
|
9
|
+
import { isListNode } from '@modusoperandi/licit-ui-commands';
|
|
10
|
+
import { unwrapNodesFromList } from '@modusoperandi/licit-ui-commands';
|
|
11
11
|
|
|
12
12
|
export default function toggleBlockquote(
|
|
13
13
|
tr: Transform,
|
package/src/toggleCodeBlock.js
CHANGED
|
@@ -6,9 +6,9 @@ import { Transform } from 'prosemirror-transform';
|
|
|
6
6
|
|
|
7
7
|
import { MARK_LINK } from './MarkNames';
|
|
8
8
|
import { BLOCKQUOTE, CODE_BLOCK, HEADING, PARAGRAPH } from './NodeNames';
|
|
9
|
-
import { clearMarks } from '
|
|
10
|
-
import compareNumber from '
|
|
11
|
-
import isListNode from '
|
|
9
|
+
import { clearMarks } from '@modusoperandi/licit-ui-commands';
|
|
10
|
+
import { compareNumber } from '@modusoperandi/licit-ui-commands';
|
|
11
|
+
import { isListNode } from '@modusoperandi/licit-ui-commands';
|
|
12
12
|
|
|
13
13
|
export default function toggleCodeBlock(
|
|
14
14
|
tr: Transform,
|
package/src/ui/CommandButton.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Transform } from 'prosemirror-transform';
|
|
|
5
5
|
import { EditorView } from 'prosemirror-view';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
|
|
8
|
-
import CustomButton from '
|
|
8
|
+
import { CustomButton } from '@modusoperandi/licit-ui-commands';
|
|
9
9
|
import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
|
|
10
10
|
|
|
11
11
|
class CommandButton extends React.PureComponent<any, any> {
|
|
@@ -7,9 +7,9 @@ import { EditorView } from 'prosemirror-view';
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
9
|
import CommandMenu from './CommandMenu';
|
|
10
|
-
import CustomButton from '
|
|
10
|
+
import { CustomButton } 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
|
import uuid from './uuid';
|
|
14
14
|
|
|
15
15
|
import './czi-custom-menu-button.css';
|
package/src/ui/CustomMenuItem.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
import './czi-custom-menu-item.css';
|
|
4
|
-
import CustomButton from '
|
|
4
|
+
import { CustomButton } from '@modusoperandi/licit-ui-commands';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
|
|
7
7
|
class CustomMenuItemSeparator extends React.PureComponent<any, any> {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
import './czi-custom-radio-button.css';
|
|
4
|
-
import PointerSurface from '
|
|
4
|
+
import { PointerSurface } from '@modusoperandi/licit-ui-commands';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
import uuid from './uuid';
|
|
8
|
-
import preventEventDefault from '
|
|
8
|
+
import { preventEventDefault } from '@modusoperandi/licit-ui-commands';
|
|
9
9
|
|
|
10
|
-
import type { PointerSurfaceProps } from '
|
|
10
|
+
import type { PointerSurfaceProps } from '@modusoperandi/licit-ui-commands';;
|
|
11
11
|
|
|
12
12
|
class CustomRadioButton extends React.PureComponent<any, any> {
|
|
13
13
|
props: PointerSurfaceProps & {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { LAYOUT } from '../DocNodeSpec';
|
|
5
|
-
import CustomButton from '
|
|
5
|
+
import { CustomButton } from '@modusoperandi/licit-ui-commands';
|
|
6
6
|
import CustomRadioButton from './CustomRadioButton';
|
|
7
|
-
import preventEventDefault from '
|
|
7
|
+
import { preventEventDefault } from '@modusoperandi/licit-ui-commands';
|
|
8
8
|
|
|
9
9
|
import './czi-body-layout-editor.css';
|
|
10
10
|
import './czi-form.css';
|
package/src/ui/Editor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
import cx from 'classnames';
|
|
4
|
-
import {
|
|
4
|
+
import { Schema } from 'prosemirror-model';
|
|
5
5
|
import { EditorState, Transaction } from 'prosemirror-state';
|
|
6
6
|
import { Transform } from 'prosemirror-transform';
|
|
7
7
|
import { EditorView } from 'prosemirror-view';
|
|
@@ -158,7 +158,6 @@ class Editor extends React.PureComponent<any, any> {
|
|
|
158
158
|
|
|
159
159
|
// Reference: http://prosemirror.net/examples/basic/
|
|
160
160
|
const view = (this._editorView = new CustomEditorView(editorNode, {
|
|
161
|
-
clipboardSerializer: DOMSerializer.fromSchema(schema),
|
|
162
161
|
dispatchTransaction,
|
|
163
162
|
editable: this._isEditable,
|
|
164
163
|
nodeViews: boundNodeViews,
|
package/src/ui/EditorToolbar.js
CHANGED
|
@@ -9,7 +9,7 @@ import ReactDOM from 'react-dom';
|
|
|
9
9
|
|
|
10
10
|
import CommandButton from './CommandButton';
|
|
11
11
|
import CommandMenuButton from './CommandMenuButton';
|
|
12
|
-
import CustomButton from '
|
|
12
|
+
import { CustomButton } from '@modusoperandi/licit-ui-commands';
|
|
13
13
|
import { COMMAND_GROUPS, parseLabel } from './EditorToolbarConfig';
|
|
14
14
|
import Icon from './Icon';
|
|
15
15
|
import ResizeObserver from './ResizeObserver';
|
|
@@ -5,7 +5,7 @@ import { Transform } from 'prosemirror-transform';
|
|
|
5
5
|
import { EditorView } from 'prosemirror-view';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
|
|
8
|
-
import FontSizeCommand from '
|
|
8
|
+
import {FontSizeCommand} from '@modusoperandi/licit-ui-commands';
|
|
9
9
|
import CommandMenuButton from './CommandMenuButton';
|
|
10
10
|
import findActiveFontSize from './findActiveFontSize';
|
|
11
11
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
import CommandMenuButton from './CommandMenuButton';
|
|
4
|
-
import FontTypeCommand from '
|
|
4
|
+
import {FontTypeCommand} from '@modusoperandi/licit-ui-commands';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import findActiveFontType from './findActiveFontType';
|
|
7
7
|
import { EditorState } from 'prosemirror-state';
|
package/src/ui/ImageNodeView.js
CHANGED
|
@@ -13,9 +13,9 @@ import Icon from './Icon';
|
|
|
13
13
|
import ImageInlineEditor from './ImageInlineEditor';
|
|
14
14
|
import ImageResizeBox from './ImageResizeBox';
|
|
15
15
|
import { MIN_SIZE } from './ImageResizeBox';
|
|
16
|
-
import { atAnchorBottomCenter } from '
|
|
16
|
+
import { atAnchorBottomCenter } from '@modusoperandi/licit-ui-commands';
|
|
17
17
|
import ResizeObserver from './ResizeObserver';
|
|
18
|
-
import createPopUp from '
|
|
18
|
+
import { createPopUp } from '@modusoperandi/licit-ui-commands';
|
|
19
19
|
import resolveImage from './resolveImage';
|
|
20
20
|
import uuid from './uuid';
|
|
21
21
|
|
package/src/ui/ImageResizeBox.js
CHANGED
package/src/ui/ImageURLEditor.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
|
|
6
|
-
import CustomButton from '
|
|
7
|
-
import preventEventDefault from '
|
|
6
|
+
import { CustomButton } from '@modusoperandi/licit-ui-commands';
|
|
7
|
+
import { preventEventDefault } from '@modusoperandi/licit-ui-commands';
|
|
8
8
|
import resolveImage from './resolveImage';
|
|
9
9
|
|
|
10
10
|
import './czi-form.css';
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
|
|
6
|
-
import CustomButton from '
|
|
6
|
+
import { CustomButton } from '@modusoperandi/licit-ui-commands';
|
|
7
7
|
import LoadingIndicator from './LoadingIndicator';
|
|
8
|
-
import preventEventDefault from '
|
|
8
|
+
import { preventEventDefault } from '@modusoperandi/licit-ui-commands';
|
|
9
9
|
import uuid from './uuid';
|
|
10
10
|
|
|
11
11
|
import './czi-form.css';
|
package/src/ui/LinkTooltip.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import scrollIntoView from 'smooth-scroll-into-view-if-needed';
|
|
6
6
|
|
|
7
7
|
import sanitizeURL from '../sanitizeURL';
|
|
8
|
-
import CustomButton from '
|
|
8
|
+
import { CustomButton } from '@modusoperandi/licit-ui-commands';
|
|
9
9
|
|
|
10
10
|
import './czi-link-tooltip.css';
|
|
11
11
|
|
package/src/ui/LinkURLEditor.js
CHANGED
|
@@ -4,9 +4,9 @@ import * as React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
|
|
6
6
|
import sanitizeURL from '../sanitizeURL';
|
|
7
|
-
import CustomButton from '
|
|
7
|
+
import { CustomButton } from '@modusoperandi/licit-ui-commands';
|
|
8
8
|
import { ENTER } from './KeyCodes';
|
|
9
|
-
import preventEventDefault from '
|
|
9
|
+
import { preventEventDefault } from '@modusoperandi/licit-ui-commands';
|
|
10
10
|
|
|
11
11
|
import './czi-form.css';
|
|
12
12
|
import './czi-image-url-editor.css';
|
package/src/ui/ListTypeButton.js
CHANGED
|
@@ -8,9 +8,9 @@ import { EditorState } from 'prosemirror-state';
|
|
|
8
8
|
import { Transform } from 'prosemirror-transform';
|
|
9
9
|
import { EditorView } from 'prosemirror-view';
|
|
10
10
|
import * as React from 'react';
|
|
11
|
-
import CustomButton from '
|
|
11
|
+
import { CustomButton } from '@modusoperandi/licit-ui-commands';
|
|
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 uuid from './uuid';
|
|
15
15
|
import ListTypeMenu from './ListTypeMenu';
|
|
16
16
|
import './czi-custom-menu-button.css';
|
package/src/ui/MathEditor.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
|
|
6
|
-
import CustomButton from '
|
|
6
|
+
import { CustomButton } from '@modusoperandi/licit-ui-commands';
|
|
7
7
|
import MathQuillEditor from './mathquill-editor/MathQuillEditor';
|
|
8
|
-
import preventEventDefault from '
|
|
8
|
+
import { preventEventDefault } from '@modusoperandi/licit-ui-commands';
|
|
9
9
|
import uuid from './uuid';
|
|
10
10
|
|
|
11
11
|
import './czi-form.css';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
import './czi-inline-editor.css';
|
|
4
|
-
import CustomButton from '
|
|
4
|
+
import { CustomButton } from '@modusoperandi/licit-ui-commands';
|
|
5
5
|
import CustomEditorView from './CustomEditorView';
|
|
6
6
|
import MathEditor from './MathEditor';
|
|
7
7
|
import * as React from 'react';
|
|
8
|
-
import createPopUp from '
|
|
8
|
+
import { createPopUp } from '@modusoperandi/licit-ui-commands';
|
|
9
9
|
|
|
10
10
|
const MathAlignValues = {
|
|
11
11
|
NONE: {
|
package/src/ui/MathNodeView.js
CHANGED
|
@@ -4,14 +4,14 @@ import './czi-math-view.css';
|
|
|
4
4
|
import CustomNodeView from './CustomNodeView';
|
|
5
5
|
import MathInlineEditor from './MathInlineEditor';
|
|
6
6
|
import * as React from 'react';
|
|
7
|
-
import createPopUp from '
|
|
7
|
+
import { createPopUp } from '@modusoperandi/licit-ui-commands';
|
|
8
8
|
import cx from 'classnames';
|
|
9
9
|
import renderLaTeXAsHTML from './renderLaTeXAsHTML';
|
|
10
10
|
import uuid from './uuid';
|
|
11
11
|
import { Decoration } from 'prosemirror-view';
|
|
12
12
|
import { FRAMESET_BODY_CLASSNAME } from './EditorFrameset';
|
|
13
13
|
import { Node } from 'prosemirror-model';
|
|
14
|
-
import { atAnchorBottomCenter } from '
|
|
14
|
+
import { atAnchorBottomCenter } from '@modusoperandi/licit-ui-commands';
|
|
15
15
|
import { NodeSelection } from 'prosemirror-state';
|
|
16
16
|
|
|
17
17
|
import type { NodeViewProps } from './CustomNodeView';
|
|
@@ -4,9 +4,9 @@ import cx from 'classnames';
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import ReactDOM from 'react-dom';
|
|
6
6
|
|
|
7
|
-
import clamp from '
|
|
7
|
+
import { clamp } from '@modusoperandi/licit-ui-commands';
|
|
8
8
|
import htmlElementToRect from './htmlElementToRect';
|
|
9
|
-
import { fromHTMlElement, fromXY, isIntersected } from '
|
|
9
|
+
import { fromHTMlElement, fromXY, isIntersected } from '@modusoperandi/licit-ui-commands';
|
|
10
10
|
|
|
11
11
|
import './czi-table-grid-size-editor.css';
|
|
12
12
|
|
package/src/ui/czi-vars.css
CHANGED
|
@@ -1,46 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
--czi-blockquote-background-color: rgba(0, 0, 0, 0.05);
|
|
3
|
-
--czi-blockquote-border: solid 8px rgba(0, 0, 0, 0.6);
|
|
4
|
-
--czi-blockquote-color: #555;
|
|
5
|
-
--czi-blockquote-font-family: 'Open Sans';
|
|
6
|
-
--czi-border-blue: solid 1px #5882eb;
|
|
7
|
-
--czi-border-grey: solid 1px #ccc;
|
|
8
|
-
--czi-border-red: solid 1px #f00;
|
|
9
|
-
--czi-button-hover-background-color: rgba(0, 0, 0, 0.05);
|
|
10
|
-
--czi-button-radius: 5px;
|
|
11
|
-
--czi-button-text-color: #666;
|
|
12
|
-
--czi-color-grey-200: rgba(0, 0, 0, 0.46);
|
|
13
|
-
--czi-font-family: helvetica;
|
|
14
|
-
--czi-font-size-small: 12px;
|
|
15
|
-
--czi-font-size: 13px;
|
|
16
|
-
--czi-link-color: rgb(0, 0, 238);
|
|
17
|
-
--czi-overlay-radius: 3px;
|
|
18
|
-
--czi-overlay-shadow: 0 1px 2px rgba(0, 0, 0, 0.46);
|
|
19
|
-
--czi-page-background-color: #e6e6e6;
|
|
20
|
-
--czi-page-background-color: #e6e6e6;
|
|
21
|
-
--czi-placeholder-text-color: #dedede;
|
|
22
|
-
--czi-selection-highlight-color-dark: rgba(152, 204, 253, 0.8);
|
|
23
|
-
--czi-selection-highlight-color: rgba(152, 204, 253, 0.4);
|
|
24
|
-
--czi-table-header-background-color: rgba(0, 0, 0, 0.05);
|
|
25
|
-
--czi-table-border-color: #000;
|
|
26
|
-
--czi-doc-padding-default: 14.5mm;
|
|
27
|
-
--czi-doc-width-us-letter-portrait: 216mm;
|
|
28
|
-
--czi-doc-width-us-letter-landscape: 279mm;
|
|
29
|
-
--czi-doc-width-a4-portrait: 210mm;
|
|
30
|
-
--czi-doc-width-a4-landscape: 297mm;
|
|
31
|
-
--czi-doc-width-us-desktop-screen-4-3: 120vh;
|
|
32
|
-
--czi-doc-width-us-desktop-screen-16-9: 142vh;
|
|
1
|
+
@import '../../node_modules/@modusoperandi/licit-ui-commands/dist/ui/czi-vars.css';
|
|
33
2
|
|
|
34
|
-
/* content styles */
|
|
35
|
-
--czi-content-body-background-color: #fff;
|
|
36
|
-
--czi-content-font-color: #000;
|
|
37
|
-
--czi-content-font-family: arial;
|
|
38
|
-
--czi-content-font-size-h1: 18px;
|
|
39
|
-
--czi-content-font-size-h2: 16px;
|
|
40
|
-
--czi-content-font-size-h3: 13px;
|
|
41
|
-
--czi-content-font-size: 11pt;
|
|
42
|
-
|
|
43
|
-
/* This maps to the default line spacing value of 1.5 in Google Doc */
|
|
44
|
-
--czi-content-line-height: 138%;
|
|
45
|
-
--czi-content-link-color: rgb(0, 0, 238);
|
|
46
|
-
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import renderLaTeXAsHTML from '../renderLaTeXAsHTML';
|
|
4
4
|
import './czi-mathquill-editor-symbols-panel.css';
|
|
5
|
-
import CustomButton from '
|
|
5
|
+
import { CustomButton } from '@modusoperandi/licit-ui-commands';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
|
|
8
8
|
import type { MathQuillEditorSymbol } from './MathQuillEditorSymbols';
|
|
@@ -6,9 +6,6 @@ export const LINE_SPACING_115 = '138%';
|
|
|
6
6
|
export const LINE_SPACING_150 = '165%';
|
|
7
7
|
export const LINE_SPACING_200 = '232%';
|
|
8
8
|
|
|
9
|
-
export const SINGLE_LINE_SPACING = LINE_SPACING_100;
|
|
10
|
-
export const DOUBLE_LINE_SPACING = LINE_SPACING_200;
|
|
11
|
-
|
|
12
9
|
const NUMBER_VALUE_PATTERN = /^\d+(.\d+)?$/;
|
|
13
10
|
|
|
14
11
|
// Normalize the css line-height vlaue to percentage-based value if applicable.
|
|
@@ -56,27 +53,3 @@ export default function toCSSLineSpacing(source: any): string {
|
|
|
56
53
|
// e.g. line-height: 15px;
|
|
57
54
|
return strValue;
|
|
58
55
|
}
|
|
59
|
-
|
|
60
|
-
// [FS] IRAD-1104 2020-11-13
|
|
61
|
-
// Issue fix : Linespacing Double and Single not applied in the sample text paragraph
|
|
62
|
-
export function getLineSpacingValue(lineSpacing: string): string {
|
|
63
|
-
let _lineSpaceValue = '';
|
|
64
|
-
switch (lineSpacing) {
|
|
65
|
-
case 'Single':
|
|
66
|
-
_lineSpaceValue = SINGLE_LINE_SPACING;
|
|
67
|
-
break;
|
|
68
|
-
case '1.15':
|
|
69
|
-
_lineSpaceValue = LINE_SPACING_115;
|
|
70
|
-
break;
|
|
71
|
-
case '1.5':
|
|
72
|
-
_lineSpaceValue = LINE_SPACING_150;
|
|
73
|
-
break;
|
|
74
|
-
case 'Double':
|
|
75
|
-
_lineSpaceValue = DOUBLE_LINE_SPACING;
|
|
76
|
-
break;
|
|
77
|
-
default:
|
|
78
|
-
_lineSpaceValue = SINGLE_LINE_SPACING;
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
return _lineSpaceValue;
|
|
82
|
-
}
|
package/dist/FontSizeCommand.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
|
|
9
|
-
|
|
10
|
-
var _applyMark = _interopRequireDefault(require("./applyMark"));
|
|
11
|
-
|
|
12
|
-
var _isTextStyleMarkCommandEnabled = _interopRequireDefault(require("./isTextStyleMarkCommandEnabled"));
|
|
13
|
-
|
|
14
|
-
var _prosemirrorState = require("prosemirror-state");
|
|
15
|
-
|
|
16
|
-
var _prosemirrorView = require("prosemirror-view");
|
|
17
|
-
|
|
18
|
-
var _MarkNames = require("./MarkNames");
|
|
19
|
-
|
|
20
|
-
var _prosemirrorModel = require("prosemirror-model");
|
|
21
|
-
|
|
22
|
-
var _prosemirrorTransform = require("prosemirror-transform");
|
|
23
|
-
|
|
24
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
|
-
|
|
28
|
-
function setFontSize(tr, schema, pt) {
|
|
29
|
-
const markType = schema.marks[_MarkNames.MARK_FONT_SIZE];
|
|
30
|
-
|
|
31
|
-
if (!markType) {
|
|
32
|
-
return tr;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const attrs = pt ? {
|
|
36
|
-
pt
|
|
37
|
-
} : null;
|
|
38
|
-
tr = (0, _applyMark.default)(tr, schema, markType, attrs);
|
|
39
|
-
return tr;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
class FontSizeCommand extends _licitDocAttrsStep.UICommand {
|
|
43
|
-
constructor(pt) {
|
|
44
|
-
super();
|
|
45
|
-
|
|
46
|
-
_defineProperty(this, "_popUp", null);
|
|
47
|
-
|
|
48
|
-
_defineProperty(this, "_pt", 0);
|
|
49
|
-
|
|
50
|
-
_defineProperty(this, "isEnabled", state => {
|
|
51
|
-
return (0, _isTextStyleMarkCommandEnabled.default)(state, _MarkNames.MARK_FONT_SIZE);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
_defineProperty(this, "execute", (state, dispatch, view) => {
|
|
55
|
-
const {
|
|
56
|
-
schema
|
|
57
|
-
} = state; // commnted selection because selection removes the storedMarks;
|
|
58
|
-
// {selection}
|
|
59
|
-
// const tr = setFontSize(state.tr.setSelection(selection), schema, this._pt);
|
|
60
|
-
|
|
61
|
-
const tr = setFontSize(state.tr, schema, this._pt);
|
|
62
|
-
|
|
63
|
-
if (tr.docChanged || tr.storedMarksSet) {
|
|
64
|
-
// If selection is empty, the color is added to `storedMarks`, which
|
|
65
|
-
// works like `toggleMark`
|
|
66
|
-
// (see https://prosemirror.net/docs/ref/#commands.toggleMark).
|
|
67
|
-
dispatch && dispatch(tr);
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return false;
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
this._pt = pt;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
var _default = FontSizeCommand;
|
|
80
|
-
exports.default = _default;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
|
|
4
|
-
import applyMark from './applyMark';
|
|
5
|
-
import isTextStyleMarkCommandEnabled from './isTextStyleMarkCommandEnabled';
|
|
6
|
-
import { EditorState } from 'prosemirror-state';
|
|
7
|
-
import { EditorView } from 'prosemirror-view';
|
|
8
|
-
import { MARK_FONT_SIZE } from './MarkNames';
|
|
9
|
-
import { Schema } from 'prosemirror-model';
|
|
10
|
-
import { Transform } from 'prosemirror-transform';
|
|
11
|
-
|
|
12
|
-
function setFontSize(tr: Transform, schema: Schema, pt: number): Transform {
|
|
13
|
-
const markType = schema.marks[MARK_FONT_SIZE];
|
|
14
|
-
if (!markType) {
|
|
15
|
-
return tr;
|
|
16
|
-
}
|
|
17
|
-
const attrs = pt ? { pt } : null;
|
|
18
|
-
tr = applyMark(tr, schema, markType, attrs);
|
|
19
|
-
return tr;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
class FontSizeCommand extends UICommand {
|
|
23
|
-
_popUp = null;
|
|
24
|
-
_pt = 0;
|
|
25
|
-
|
|
26
|
-
constructor(pt: number) {
|
|
27
|
-
super();
|
|
28
|
-
this._pt = pt;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
isEnabled = (state: EditorState): boolean => {
|
|
32
|
-
return isTextStyleMarkCommandEnabled(state, MARK_FONT_SIZE);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
execute = (
|
|
36
|
-
state: EditorState,
|
|
37
|
-
dispatch: ?(tr: Transform) => void,
|
|
38
|
-
view: ?EditorView
|
|
39
|
-
): boolean => {
|
|
40
|
-
const { schema } = state;
|
|
41
|
-
// commnted selection because selection removes the storedMarks;
|
|
42
|
-
// {selection}
|
|
43
|
-
// const tr = setFontSize(state.tr.setSelection(selection), schema, this._pt);
|
|
44
|
-
const tr = setFontSize(state.tr, schema, this._pt);
|
|
45
|
-
if (tr.docChanged || tr.storedMarksSet) {
|
|
46
|
-
// If selection is empty, the color is added to `storedMarks`, which
|
|
47
|
-
// works like `toggleMark`
|
|
48
|
-
// (see https://prosemirror.net/docs/ref/#commands.toggleMark).
|
|
49
|
-
dispatch && dispatch(tr);
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
return false;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export default FontSizeCommand;
|