@modusoperandi/licit 0.13.25 → 0.14.0

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.
Files changed (200) hide show
  1. package/.eslintrc.js +1 -1
  2. package/README.md +1 -0
  3. package/dist/BlockquoteInsertNewLineCommand.js +3 -23
  4. package/dist/BlockquoteNodeSpec.js +3 -13
  5. package/dist/BlockquoteToggleCommand.js +3 -16
  6. package/dist/BookmarkNodeSpec.js +0 -6
  7. package/dist/BulletListNodeSpec.js +2 -16
  8. package/dist/CZIProseMirror.js +3 -27
  9. package/dist/CodeBlockCommand.js +3 -19
  10. package/dist/CodeBlockNodeSpec.js +3 -4
  11. package/dist/CodeMarkSpec.js +0 -4
  12. package/dist/ContentPlaceholderPlugin.js +6 -58
  13. package/dist/CursorPlaceholderPlugin.js +2 -32
  14. package/dist/DocLayoutCommand.js +5 -28
  15. package/dist/DocNodeSpec.js +0 -9
  16. package/dist/EMMarkSpec.js +0 -4
  17. package/dist/EditorCommands.js +5 -33
  18. package/dist/EditorKeyMap.js +4 -18
  19. package/dist/EditorMarks.js +2 -26
  20. package/dist/EditorNodes.js +4 -22
  21. package/dist/EditorPageLayoutPlugin.js +3 -15
  22. package/dist/EditorPlugins.js +0 -4
  23. package/dist/EditorSchema.js +0 -5
  24. package/dist/EditorState.js +0 -2
  25. package/dist/FontSizeMarkSpec.js +0 -12
  26. package/dist/FontTypeMarkSpec.js +15 -19
  27. package/dist/HTMLMutator.js +5 -24
  28. package/dist/HardBreakNodeSpec.js +0 -2
  29. package/dist/HeadingNodeSpec.js +6 -15
  30. package/dist/HistoryRedoCommand.js +3 -11
  31. package/dist/HistoryUndoCommand.js +3 -11
  32. package/dist/HorizontalRuleCommand.js +3 -22
  33. package/dist/HorizontalRuleNodeSpec.js +0 -10
  34. package/dist/ImageFromURLCommand.js +0 -9
  35. package/dist/ImageNodeSpec.js +2 -14
  36. package/dist/ImageSourceCommand.js +3 -39
  37. package/dist/ImageUploadCommand.js +3 -21
  38. package/dist/ImageUploadPlaceholderPlugin.js +10 -48
  39. package/dist/LinkMarkSpec.js +0 -4
  40. package/dist/LinkSetURLCommand.js +3 -28
  41. package/dist/LinkTooltipPlugin.js +6 -52
  42. package/dist/ListItemInsertNewLineCommand.js +3 -23
  43. package/dist/ListItemMergeCommand.js +15 -66
  44. package/dist/ListItemNodeSpec.js +0 -11
  45. package/dist/ListSplitCommand.js +3 -14
  46. package/dist/ListToggleCommand.js +5 -26
  47. package/dist/MarksClearCommand.js +6 -17
  48. package/dist/MathEditCommand.js +3 -38
  49. package/dist/MathNodeSpec.js +0 -10
  50. package/dist/OrderedListNodeSpec.js +0 -24
  51. package/dist/ParagraphNodeSpec.js +5 -26
  52. package/dist/ParagraphSpacingCommand.js +3 -32
  53. package/dist/PrintCommand.js +3 -13
  54. package/dist/SelectionPlaceholderPlugin.js +2 -31
  55. package/dist/SpacerMarkSpec.js +2 -6
  56. package/dist/StrikeMarkSpec.js +0 -4
  57. package/dist/StrongMarkSpec.js +2 -5
  58. package/dist/StyleView.js +1 -7
  59. package/dist/TableBackgroundColorCommand.js +3 -24
  60. package/dist/TableBorderColorCommand.js +3 -24
  61. package/dist/TableCellColorCommand.js +3 -23
  62. package/dist/TableCellMenuPlugin.js +9 -45
  63. package/dist/TableInsertCommand.js +7 -39
  64. package/dist/TableMergeCellsCommand.js +5 -30
  65. package/dist/TableNodesSpecs.js +4 -23
  66. package/dist/TablePlugins.js +0 -5
  67. package/dist/TableResizePlugin.js +54 -138
  68. package/dist/TextColorMarkSpec.js +0 -9
  69. package/dist/TextHighlightMarkSpec.js +0 -8
  70. package/dist/TextInsertTabSpaceCommand.js +3 -28
  71. package/dist/TextNoWrapMarkSpec.js +0 -4
  72. package/dist/TextSelectionMarkSpec.js +0 -5
  73. package/dist/TextSubMarkSpec.js +0 -4
  74. package/dist/TextSuperMarkSpec.js +0 -4
  75. package/dist/TextUnderlineMarkSpec.js +0 -4
  76. package/dist/Types.js +0 -6
  77. package/dist/WebFontLoader.js +3 -8
  78. package/dist/blockQuoteInputRule.js +0 -13
  79. package/dist/bom.xml +1492 -1645
  80. package/dist/buildEditorPlugins.js +5 -27
  81. package/dist/buildInputRules.js +12 -24
  82. package/dist/client/CollabConnector.js +6 -30
  83. package/dist/client/EditorConnection.js +23 -69
  84. package/dist/client/Licit.js +79 -163
  85. package/dist/client/Licit.js.flow +16 -2
  86. package/dist/client/Licit.test.js +6 -13
  87. package/dist/client/Reporter.js +1 -8
  88. package/dist/client/SimpleConnector.js +6 -26
  89. package/dist/client/http.js +8 -15
  90. package/dist/client/throttle.js +0 -2
  91. package/dist/convertFromDOMElement.js +2 -10
  92. package/dist/convertFromHTML.js +0 -5
  93. package/dist/convertFromJSON.js +3 -13
  94. package/dist/convertToCSSPTValue.js +0 -6
  95. package/dist/convertToJSON.js +0 -2
  96. package/dist/createCommand.js +3 -11
  97. package/dist/createEditorKeyMap.js +0 -13
  98. package/dist/createEmptyEditorState.js +0 -7
  99. package/dist/createTableResizingPlugin.js +5 -16
  100. package/dist/findActionableCell.js +0 -19
  101. package/dist/findActiveMark.js +0 -11
  102. package/dist/hyphenize.js +2 -4
  103. package/dist/index.js +0 -9
  104. package/dist/insertTable.js +0 -16
  105. package/dist/isEditorStateEmpty.js +0 -6
  106. package/dist/isTableNode.js +0 -3
  107. package/dist/joinDown.js +0 -7
  108. package/dist/joinListNode.js +0 -15
  109. package/dist/joinUp.js +0 -9
  110. package/dist/keymaps.js +0 -15
  111. package/dist/lookUpElement.js +0 -3
  112. package/dist/nodeAt.js +0 -3
  113. package/dist/normalizeHTML.js +9 -25
  114. package/dist/patchAnchorElements.js +5 -12
  115. package/dist/patchBreakElements.js +0 -6
  116. package/dist/patchElementInlineStyles.js +5 -15
  117. package/dist/patchListElements.js +20 -54
  118. package/dist/patchMathElements.js +11 -21
  119. package/dist/patchParagraphElements.js +0 -5
  120. package/dist/patchStyleElements.js +12 -41
  121. package/dist/patchTableElements.js +9 -37
  122. package/dist/rebaseDocWithSteps.js +0 -6
  123. package/dist/sanitizeURL.js +0 -3
  124. package/dist/splitListItem.js +12 -43
  125. package/dist/toClosestFontPtSize.js +1 -5
  126. package/dist/toSafeHTMLDocument.js +0 -1
  127. package/dist/toggleBlockquote.js +2 -19
  128. package/dist/toggleCodeBlock.js +2 -22
  129. package/dist/ui/AlertInfo.js +6 -22
  130. package/dist/ui/BookmarkNodeView.js +7 -28
  131. package/dist/ui/CommandButton.js +3 -19
  132. package/dist/ui/CommandMenu.js +3 -25
  133. package/dist/ui/CommandMenuButton.js +3 -36
  134. package/dist/ui/CustomEditorView.js +3 -16
  135. package/dist/ui/CustomMenu.js +0 -8
  136. package/dist/ui/CustomMenuItem.js +4 -18
  137. package/dist/ui/CustomNodeView.js +21 -67
  138. package/dist/ui/CustomRadioButton.js +14 -33
  139. package/dist/ui/DocLayoutEditor.js +5 -27
  140. package/dist/ui/Editor.js +18 -79
  141. package/dist/ui/EditorFrameset.js +3 -18
  142. package/dist/ui/EditorToolbar.js +10 -46
  143. package/dist/ui/EditorToolbarConfig.js +10 -20
  144. package/dist/ui/FontSizeCommandMenuButton.js +5 -19
  145. package/dist/ui/FontTypeCommandMenuButton.js +5 -22
  146. package/dist/ui/Frag.js +0 -7
  147. package/dist/ui/Icon.js +5 -25
  148. package/dist/ui/ImageAlignEditor.js +3 -16
  149. package/dist/ui/ImageInlineEditor.js +3 -16
  150. package/dist/ui/ImageNodeView.js +20 -109
  151. package/dist/ui/ImageResizeBox.js +3 -53
  152. package/dist/ui/ImageURLEditor.js +3 -28
  153. package/dist/ui/ImageUploadEditor.js +3 -35
  154. package/dist/ui/LinkTooltip.js +5 -25
  155. package/dist/ui/LinkURLEditor.js +3 -29
  156. package/dist/ui/ListItemNodeView.js +15 -30
  157. package/dist/ui/ListTypeButton.js +5 -37
  158. package/dist/ui/ListTypeCommandButton.js +3 -19
  159. package/dist/ui/ListTypeMenu.js +4 -25
  160. package/dist/ui/LoadingIndicator.js +0 -7
  161. package/dist/ui/MathEditor.js +3 -24
  162. package/dist/ui/MathInlineEditor.js +3 -26
  163. package/dist/ui/MathNodeView.js +9 -59
  164. package/dist/ui/PasteMenu.js +4 -20
  165. package/dist/ui/ResizeObserver.js +0 -18
  166. package/dist/ui/RichTextEditor.js +5 -27
  167. package/dist/ui/SelectionObserver.js +3 -29
  168. package/dist/ui/TableCellMenu.js +3 -18
  169. package/dist/ui/TableGridSizeEditor.js +5 -51
  170. package/dist/ui/TableNodeView.js +0 -11
  171. package/dist/ui/bindScrollHandler.js +2 -9
  172. package/dist/ui/canUseCSSFont.js +2 -8
  173. package/dist/ui/czi-icon.css +4 -4
  174. package/dist/ui/findActiveFontSize.js +2 -18
  175. package/dist/ui/findActiveFontType.js +0 -12
  176. package/dist/ui/handleEditorDrop.js +0 -9
  177. package/dist/ui/handleEditorKeyDown.js +0 -7
  178. package/dist/ui/handleEditorPaste.js +0 -9
  179. package/dist/ui/htmlElementToRect.js +0 -4
  180. package/dist/ui/injectStyleSheet.js +0 -10
  181. package/dist/ui/isElementFullyVisible.js +2 -8
  182. package/dist/ui/isOffline.js +0 -2
  183. package/dist/ui/isReactClass.js +0 -4
  184. package/dist/ui/mathquill-editor/MathQuillEditor.js +9 -44
  185. package/dist/ui/mathquill-editor/MathQuillEditorSymbols.js +1 -3
  186. package/dist/ui/mathquill-editor/MathQuillEditorSymbolsPanel.js +3 -16
  187. package/dist/ui/mathquill-editor/mathquill-import-kludge.js +5 -7
  188. package/dist/ui/renderLaTeXAsHTML.js +2 -13
  189. package/dist/ui/resolveImage.js +7 -32
  190. package/dist/ui/toCSSColor.js +0 -14
  191. package/dist/ui/toCSSLineSpacing.js +10 -11
  192. package/dist/ui/toHexColor.js +0 -8
  193. package/dist/ui/uuid.js +0 -2
  194. package/dist/uuid.js +0 -2
  195. package/package-lock.json.old +32889 -0
  196. package/package.json +45 -69
  197. package/src/client/Licit.js +16 -2
  198. package/src/ui/czi-icon.css +4 -4
  199. package/utils/build_web_server.js +1 -7
  200. package/webpack.config.js +3 -3
@@ -5,39 +5,28 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  exports.setParagraphSpacing = setParagraphSpacing;
8
-
9
8
  var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
10
-
11
9
  var _prosemirrorState = require("prosemirror-state");
12
-
13
10
  var _NodeNames = require("./NodeNames");
14
-
15
11
  var _prosemirrorView = require("prosemirror-view");
16
-
17
12
  var _prosemirrorModel = require("prosemirror-model");
18
-
19
13
  var _prosemirrorTransform = require("prosemirror-transform");
20
-
21
14
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
22
-
23
15
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
24
-
25
- 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; }
26
-
16
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
18
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
27
19
  function setParagraphSpacing(tr, schema, paragraphSpacing, isAfter) {
28
20
  const {
29
21
  selection,
30
22
  doc
31
23
  } = tr;
32
-
33
24
  if (!selection || !doc) {
34
25
  return tr;
35
26
  }
36
-
37
27
  if (!(selection instanceof _prosemirrorState.TextSelection) && !(selection instanceof _prosemirrorState.AllSelection)) {
38
28
  return tr;
39
29
  }
40
-
41
30
  const {
42
31
  from,
43
32
  to
@@ -46,19 +35,15 @@ function setParagraphSpacing(tr, schema, paragraphSpacing, isAfter) {
46
35
  const heading = schema.nodes[_NodeNames.HEADING];
47
36
  const listItem = schema.nodes[_NodeNames.LIST_ITEM];
48
37
  const blockquote = schema.nodes[_NodeNames.BLOCKQUOTE];
49
-
50
38
  if (!paragraph && !heading && !listItem && !blockquote) {
51
39
  return tr;
52
40
  }
53
-
54
41
  const tasks = [];
55
42
  const paragraphSpacingValue = paragraphSpacing || null;
56
43
  doc.nodesBetween(from, to, (node, pos, parentNode) => {
57
44
  const nodeType = node.type;
58
-
59
45
  if (nodeType === paragraph || nodeType === heading || nodeType === listItem || nodeType === blockquote) {
60
46
  const paragraphSpacing = node.attrs.paragraphSpacing || null;
61
-
62
47
  if (paragraphSpacing !== paragraphSpacingValue) {
63
48
  tasks.push({
64
49
  node,
@@ -66,17 +51,13 @@ function setParagraphSpacing(tr, schema, paragraphSpacing, isAfter) {
66
51
  nodeType
67
52
  });
68
53
  }
69
-
70
54
  return nodeType === listItem ? true : false;
71
55
  }
72
-
73
56
  return true;
74
57
  });
75
-
76
58
  if (!tasks.length) {
77
59
  return tr;
78
60
  }
79
-
80
61
  tasks.forEach(job => {
81
62
  const {
82
63
  node,
@@ -86,7 +67,6 @@ function setParagraphSpacing(tr, schema, paragraphSpacing, isAfter) {
86
67
  let {
87
68
  attrs
88
69
  } = node;
89
-
90
70
  if (isAfter) {
91
71
  attrs = _objectSpread(_objectSpread({}, attrs), {}, {
92
72
  paragraphSpacingAfter: paragraphSpacingValue ? paragraphSpacingValue : null
@@ -96,27 +76,21 @@ function setParagraphSpacing(tr, schema, paragraphSpacing, isAfter) {
96
76
  paragraphSpacingBefore: paragraphSpacingValue ? paragraphSpacingValue : null
97
77
  });
98
78
  }
99
-
100
79
  tr = tr.setNodeMarkup(pos, nodeType, attrs, node.marks);
101
80
  });
102
81
  return tr;
103
82
  }
104
-
105
83
  class ParagraphSpacingCommand extends _licitDocAttrsStep.UICommand {
106
84
  constructor(paragraphSpacing, isAfter) {
107
85
  super();
108
-
109
86
  _defineProperty(this, "_paragraphSpacing", void 0);
110
-
111
87
  _defineProperty(this, "_isAfter", void 0);
112
-
113
88
  _defineProperty(this, "execute", (state, dispatch, view) => {
114
89
  const {
115
90
  schema,
116
91
  selection
117
92
  } = state;
118
93
  const tr = setParagraphSpacing(state.tr.setSelection(selection), schema, this._paragraphSpacing, this._isAfter);
119
-
120
94
  if (tr.docChanged) {
121
95
  dispatch && dispatch(tr);
122
96
  return true;
@@ -124,12 +98,9 @@ class ParagraphSpacingCommand extends _licitDocAttrsStep.UICommand {
124
98
  return false;
125
99
  }
126
100
  });
127
-
128
101
  this._paragraphSpacing = paragraphSpacing;
129
102
  this._isAfter = isAfter;
130
103
  }
131
-
132
104
  }
133
-
134
105
  var _default = ParagraphSpacingCommand;
135
106
  exports.default = _default;
@@ -4,40 +4,30 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _prosemirrorState = require("prosemirror-state");
9
-
10
8
  var _prosemirrorTransform = require("prosemirror-transform");
11
-
12
9
  var _prosemirrorView = require("prosemirror-view");
13
-
14
10
  var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
15
-
16
- 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; }
17
-
11
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
13
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
18
14
  class PrintCommand extends _licitDocAttrsStep.UICommand {
19
15
  constructor() {
20
16
  super(...arguments);
21
-
22
17
  _defineProperty(this, "isActive", state => {
23
18
  return false;
24
19
  });
25
-
26
20
  _defineProperty(this, "isEnabled", state => {
27
21
  return !!window.print;
28
22
  });
29
-
30
23
  _defineProperty(this, "execute", (state, dispatch, view) => {
31
24
  if (dispatch && window.print) {
32
25
  window.print();
33
26
  return true;
34
27
  }
35
-
36
28
  return false;
37
29
  });
38
30
  }
39
-
40
31
  }
41
-
42
32
  var _default = PrintCommand;
43
33
  exports.default = _default;
@@ -6,20 +6,16 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  exports.hideSelectionPlaceholder = hideSelectionPlaceholder;
8
8
  exports.showSelectionPlaceholder = showSelectionPlaceholder;
9
-
10
9
  var _prosemirrorState = require("prosemirror-state");
11
-
12
10
  var _prosemirrorTransform = require("prosemirror-transform");
13
-
14
11
  var _prosemirrorView = require("prosemirror-view");
15
-
16
12
  require("./ui/czi-selection-placeholder.css");
17
-
18
13
  const PLACE_HOLDER_ID = {
19
14
  name: 'SelectionPlaceholderPlugin'
20
15
  };
21
- let singletonInstance = null; // https://prosemirror.net/examples/upload/
16
+ let singletonInstance = null;
22
17
 
18
+ // https://prosemirror.net/examples/upload/
23
19
  const SPEC = {
24
20
  // [FS] IRAD-1005 2020-07-07
25
21
  // Upgrade outdated packages.
@@ -28,31 +24,25 @@ const SPEC = {
28
24
  init() {
29
25
  return _prosemirrorView.DecorationSet.empty;
30
26
  },
31
-
32
27
  apply(tr, set) {
33
28
  set = set.map(tr.mapping, tr.doc);
34
29
  const action = tr.getMeta(this);
35
-
36
30
  if (!action) {
37
31
  return set;
38
32
  }
39
-
40
33
  if (action.add) {
41
34
  const deco = _prosemirrorView.Decoration.inline(action.add.from, action.add.to, {
42
35
  class: 'czi-selection-placeholder'
43
36
  }, {
44
37
  id: PLACE_HOLDER_ID
45
38
  });
46
-
47
39
  set = set.add(tr.doc, [deco]);
48
40
  } else if (action.remove) {
49
41
  const found = set.find(null, null, specFinder);
50
42
  set = set.remove(found);
51
43
  }
52
-
53
44
  return set;
54
45
  }
55
-
56
46
  },
57
47
  props: {
58
48
  decorations: state => {
@@ -61,50 +51,38 @@ const SPEC = {
61
51
  }
62
52
  }
63
53
  };
64
-
65
54
  class SelectionPlaceholderPlugin extends _prosemirrorState.Plugin {
66
55
  constructor() {
67
56
  super(SPEC);
68
-
69
57
  if (singletonInstance) {
70
58
  return singletonInstance;
71
59
  }
72
-
73
60
  singletonInstance = this;
74
61
  }
75
-
76
62
  }
77
-
78
63
  function specFinder(spec) {
79
64
  return spec.id == PLACE_HOLDER_ID;
80
65
  }
81
-
82
66
  function findSelectionPlaceholder(state) {
83
67
  if (!singletonInstance) {
84
68
  return null;
85
69
  }
86
-
87
70
  if (!state.plugins.includes(singletonInstance)) {
88
71
  console.warn('SelectionPlaceholderPlugin is not installed');
89
72
  return null;
90
73
  }
91
-
92
74
  const decos = singletonInstance.getState(state);
93
75
  const found = decos.find(null, null, specFinder);
94
76
  const pos = found.length ? found[0] : null;
95
77
  return pos || null;
96
78
  }
97
-
98
79
  function showSelectionPlaceholder(state, tr) {
99
80
  tr = tr || state.tr;
100
81
  const plugin = singletonInstance;
101
-
102
82
  if (!plugin || !tr.selection || tr.selection.empty) {
103
83
  return tr;
104
84
  }
105
-
106
85
  const deco = findSelectionPlaceholder(state);
107
-
108
86
  if (deco === null) {
109
87
  tr = tr.setMeta(plugin, {
110
88
  add: {
@@ -113,28 +91,21 @@ function showSelectionPlaceholder(state, tr) {
113
91
  }
114
92
  });
115
93
  }
116
-
117
94
  return tr;
118
95
  }
119
-
120
96
  function hideSelectionPlaceholder(state, tr) {
121
97
  tr = tr || state.tr;
122
98
  const plugin = singletonInstance;
123
-
124
99
  if (!plugin) {
125
100
  return tr;
126
101
  }
127
-
128
102
  const deco = findSelectionPlaceholder(state);
129
-
130
103
  if (deco) {
131
104
  tr = tr.setMeta(plugin, {
132
105
  remove: {}
133
106
  });
134
107
  }
135
-
136
108
  return tr;
137
109
  }
138
-
139
110
  var _default = SelectionPlaceholderPlugin;
140
111
  exports.default = _default;
@@ -4,17 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports.SPACER_SIZE_TAB_LARGE = exports.SPACER_SIZE_TAB = exports.HAIR_SPACE_CHAR = exports.DOM_ATTRIBUTE_SIZE = void 0;
7
-
8
7
  var _prosemirrorModel = require("prosemirror-model");
9
-
10
8
  var _Types = require("./Types");
11
-
12
9
  const DOM_ATTRIBUTE_SIZE = 'data-spacer-size';
13
10
  exports.DOM_ATTRIBUTE_SIZE = DOM_ATTRIBUTE_SIZE;
14
11
  const SPACER_SIZE_TAB = 'tab';
15
12
  exports.SPACER_SIZE_TAB = SPACER_SIZE_TAB;
16
- const SPACER_SIZE_TAB_LARGE = 'tab-large'; // See http://jkorpela.fi/chars/spaces.html
13
+ const SPACER_SIZE_TAB_LARGE = 'tab-large';
17
14
 
15
+ // See http://jkorpela.fi/chars/spaces.html
18
16
  exports.SPACER_SIZE_TAB_LARGE = SPACER_SIZE_TAB_LARGE;
19
17
  const HAIR_SPACE_CHAR = '\u200A';
20
18
  exports.HAIR_SPACE_CHAR = HAIR_SPACE_CHAR;
@@ -39,7 +37,6 @@ const SpacerMarkSpec = {
39
37
  };
40
38
  }
41
39
  }],
42
-
43
40
  toDOM(node) {
44
41
  const {
45
42
  size
@@ -48,7 +45,6 @@ const SpacerMarkSpec = {
48
45
  [DOM_ATTRIBUTE_SIZE]: size
49
46
  }, 0];
50
47
  }
51
-
52
48
  };
53
49
  var _default = SpacerMarkSpec;
54
50
  exports.default = _default;
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _Types = require("./Types");
9
-
10
8
  // https://bitbucket.org/atlassian/atlaskit/src/34facee3f461/packages/editor-core/src/schema/nodes/?at=master
11
9
  const StrikeMarkSpec = {
12
10
  parseDOM: [{
@@ -15,14 +13,12 @@ const StrikeMarkSpec = {
15
13
  return value === 'line-through' && null;
16
14
  }
17
15
  }],
18
-
19
16
  toDOM() {
20
17
  const style = 'text-decoration: line-through';
21
18
  return ['span', {
22
19
  style
23
20
  }, 0];
24
21
  }
25
-
26
22
  };
27
23
  var _default = StrikeMarkSpec;
28
24
  exports.default = _default;
@@ -4,15 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _Types = require("./Types");
9
-
10
8
  const STRONG_DOM = ['strong', 0];
11
9
  const CSS_BOLD_PATTERN = /^(bold(er)?|[5-9]\d{2,})$/;
12
10
  const StrongMarkSpec = {
13
11
  parseDOM: [{
14
12
  tag: 'strong'
15
- }, // This works around a Google Docs misbehavior where
13
+ },
14
+ // This works around a Google Docs misbehavior where
16
15
  // pasted content will be inexplicably wrapped in `<b>`
17
16
  // tags with a font-weight normal.
18
17
  {
@@ -22,11 +21,9 @@ const StrongMarkSpec = {
22
21
  style: 'font-weight',
23
22
  getAttrs: value => CSS_BOLD_PATTERN.test(value) && null
24
23
  }],
25
-
26
24
  toDOM() {
27
25
  return STRONG_DOM;
28
26
  }
29
-
30
27
  };
31
28
  var _default = StrongMarkSpec;
32
29
  exports.default = _default;
package/dist/StyleView.js CHANGED
@@ -4,26 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.StyleView = void 0;
7
-
8
7
  var _prosemirrorView = require("prosemirror-view");
9
-
10
8
  var _prosemirrorState = require("prosemirror-state");
11
-
12
9
  // temp view for custom style have to check this view is needed?
10
+
13
11
  class StyleView {
14
12
  constructor(editorView) {
15
13
  this.update(editorView, null);
16
14
  }
17
-
18
15
  update(view, lastState) {
19
16
  if (view.readOnly) {
20
17
  this.destroy();
21
18
  return;
22
19
  }
23
20
  }
24
-
25
21
  destroy() {}
26
-
27
22
  }
28
-
29
23
  exports.StyleView = StyleView;
@@ -4,52 +4,36 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _nullthrows = _interopRequireDefault(require("nullthrows"));
9
-
10
8
  var _prosemirrorState = require("prosemirror-state");
11
-
12
9
  var _prosemirrorTables = require("prosemirror-tables");
13
-
14
10
  var _prosemirrorTransform = require("prosemirror-transform");
15
-
16
11
  var _prosemirrorView = require("prosemirror-view");
17
-
18
12
  var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
19
-
20
13
  var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
21
-
22
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- 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; }
25
-
15
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
17
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
26
18
  const setCellBackgroundBlack = (0, _prosemirrorTables.setCellAttr)('background', '#000000');
27
-
28
19
  class TableBackgroundColorCommand extends _licitDocAttrsStep.UICommand {
29
20
  constructor() {
30
21
  super(...arguments);
31
-
32
22
  _defineProperty(this, "_popUp", null);
33
-
34
23
  _defineProperty(this, "shouldRespondToUIEvent", e => {
35
24
  return e.type === _licitDocAttrsStep.UICommand.EventType.MOUSEENTER;
36
25
  });
37
-
38
26
  _defineProperty(this, "isEnabled", state => {
39
27
  return setCellBackgroundBlack(state.tr);
40
28
  });
41
-
42
29
  _defineProperty(this, "waitForUserInput", (state, dispatch, view, event) => {
43
30
  if (this._popUp) {
44
31
  return Promise.resolve(undefined);
45
32
  }
46
-
47
33
  const target = (0, _nullthrows.default)(event).currentTarget;
48
-
49
34
  if (!(target instanceof HTMLElement)) {
50
35
  return Promise.resolve(undefined);
51
36
  }
52
-
53
37
  const anchor = event ? event.currentTarget : null;
54
38
  return new Promise(resolve => {
55
39
  this._popUp = (0, _licitUiCommands.createPopUp)(_licitUiCommands.ColorEditor, null, {
@@ -64,23 +48,18 @@ class TableBackgroundColorCommand extends _licitDocAttrsStep.UICommand {
64
48
  });
65
49
  });
66
50
  });
67
-
68
51
  _defineProperty(this, "executeWithUserInput", (state, dispatch, view, hex) => {
69
52
  if (dispatch && hex !== undefined) {
70
53
  const cmd = (0, _prosemirrorTables.setCellAttr)('background', hex);
71
54
  cmd(state, dispatch, view);
72
55
  return true;
73
56
  }
74
-
75
57
  return false;
76
58
  });
77
59
  }
78
-
79
60
  cancel() {
80
61
  this._popUp && this._popUp.close(undefined);
81
62
  }
82
-
83
63
  }
84
-
85
64
  var _default = TableBackgroundColorCommand;
86
65
  exports.default = _default;
@@ -4,52 +4,36 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _nullthrows = _interopRequireDefault(require("nullthrows"));
9
-
10
8
  var _prosemirrorState = require("prosemirror-state");
11
-
12
9
  var _prosemirrorTables = require("prosemirror-tables");
13
-
14
10
  var _prosemirrorTransform = require("prosemirror-transform");
15
-
16
11
  var _prosemirrorView = require("prosemirror-view");
17
-
18
12
  var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
19
-
20
13
  var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
21
-
22
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- 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; }
25
-
15
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
17
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
26
18
  const setCellBorderBlack = (0, _prosemirrorTables.setCellAttr)('borderColor', '#000000');
27
-
28
19
  class TableBorderColorCommand extends _licitDocAttrsStep.UICommand {
29
20
  constructor() {
30
21
  super(...arguments);
31
-
32
22
  _defineProperty(this, "_popUp", null);
33
-
34
23
  _defineProperty(this, "shouldRespondToUIEvent", e => {
35
24
  return e.type === _licitDocAttrsStep.UICommand.EventType.MOUSEENTER;
36
25
  });
37
-
38
26
  _defineProperty(this, "isEnabled", state => {
39
27
  return setCellBorderBlack(state.tr);
40
28
  });
41
-
42
29
  _defineProperty(this, "waitForUserInput", (state, dispatch, view, event) => {
43
30
  if (this._popUp) {
44
31
  return Promise.resolve(undefined);
45
32
  }
46
-
47
33
  const target = (0, _nullthrows.default)(event).currentTarget;
48
-
49
34
  if (!(target instanceof HTMLElement)) {
50
35
  return Promise.resolve(undefined);
51
36
  }
52
-
53
37
  const anchor = event ? event.currentTarget : null;
54
38
  return new Promise(resolve => {
55
39
  this._popUp = (0, _licitUiCommands.createPopUp)(_licitUiCommands.ColorEditor, null, {
@@ -64,23 +48,18 @@ class TableBorderColorCommand extends _licitDocAttrsStep.UICommand {
64
48
  });
65
49
  });
66
50
  });
67
-
68
51
  _defineProperty(this, "executeWithUserInput", (state, dispatch, view, color) => {
69
52
  if (dispatch && color !== undefined) {
70
53
  const cmd = (0, _prosemirrorTables.setCellAttr)('borderColor', color);
71
54
  cmd(state, dispatch, view);
72
55
  return true;
73
56
  }
74
-
75
57
  return false;
76
58
  });
77
59
  }
78
-
79
60
  cancel() {
80
61
  this._popUp && this._popUp.close(undefined);
81
62
  }
82
-
83
63
  }
84
-
85
64
  var _default = TableBorderColorCommand;
86
65
  exports.default = _default;
@@ -4,52 +4,36 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _nullthrows = _interopRequireDefault(require("nullthrows"));
9
-
10
8
  var _prosemirrorState = require("prosemirror-state");
11
-
12
9
  var _prosemirrorTables = require("prosemirror-tables");
13
-
14
10
  var _prosemirrorTransform = require("prosemirror-transform");
15
-
16
11
  var _prosemirrorView = require("prosemirror-view");
17
-
18
12
  var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
19
-
20
13
  var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
21
-
22
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- 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; }
25
-
15
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
17
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
26
18
  const setCellBackgroundBlack = (0, _prosemirrorTables.setCellAttr)('background', '#000000');
27
-
28
19
  class TableCellColorCommand extends _licitDocAttrsStep.UICommand {
29
20
  constructor() {
30
21
  super(...arguments);
31
-
32
22
  _defineProperty(this, "_popUp", null);
33
-
34
23
  _defineProperty(this, "shouldRespondToUIEvent", e => {
35
24
  return e.type === _licitDocAttrsStep.UICommand.EventType.MOUSEENTER;
36
25
  });
37
-
38
26
  _defineProperty(this, "isEnabled", state => {
39
27
  return setCellBackgroundBlack(state.tr);
40
28
  });
41
-
42
29
  _defineProperty(this, "waitForUserInput", (state, dispatch, view, event) => {
43
30
  if (this._popUp) {
44
31
  return Promise.resolve(undefined);
45
32
  }
46
-
47
33
  const target = (0, _nullthrows.default)(event).currentTarget;
48
-
49
34
  if (!(target instanceof HTMLElement)) {
50
35
  return Promise.resolve(undefined);
51
36
  }
52
-
53
37
  const anchor = event ? event.currentTarget : null;
54
38
  return new Promise(resolve => {
55
39
  this._popUp = (0, _licitUiCommands.createPopUp)(_licitUiCommands.ColorEditor, null, {
@@ -64,19 +48,15 @@ class TableCellColorCommand extends _licitDocAttrsStep.UICommand {
64
48
  });
65
49
  });
66
50
  });
67
-
68
51
  _defineProperty(this, "executeWithUserInput", (state, dispatch, view, hex) => {
69
52
  if (dispatch && hex !== undefined) {
70
53
  const cmd = (0, _prosemirrorTables.setCellAttr)('background', hex);
71
54
  cmd(state, dispatch, view);
72
55
  return true;
73
56
  }
74
-
75
57
  return false;
76
58
  });
77
59
  }
78
-
79
60
  }
80
-
81
61
  var _default = TableCellColorCommand;
82
62
  exports.default = _default;