@modusoperandi/licit 0.13.24 → 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 (203) 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 +1582 -1732
  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 +23 -112
  151. package/dist/ui/ImageNodeView.js.flow +3 -3
  152. package/dist/ui/ImageResizeBox.js +3 -53
  153. package/dist/ui/ImageURLEditor.js +3 -28
  154. package/dist/ui/ImageUploadEditor.js +3 -35
  155. package/dist/ui/LinkTooltip.js +5 -25
  156. package/dist/ui/LinkURLEditor.js +3 -29
  157. package/dist/ui/ListItemNodeView.js +15 -30
  158. package/dist/ui/ListTypeButton.js +5 -37
  159. package/dist/ui/ListTypeCommandButton.js +3 -19
  160. package/dist/ui/ListTypeMenu.js +4 -25
  161. package/dist/ui/LoadingIndicator.js +0 -7
  162. package/dist/ui/MathEditor.js +3 -24
  163. package/dist/ui/MathInlineEditor.js +3 -26
  164. package/dist/ui/MathNodeView.js +9 -59
  165. package/dist/ui/PasteMenu.js +4 -20
  166. package/dist/ui/ResizeObserver.js +0 -18
  167. package/dist/ui/RichTextEditor.js +5 -27
  168. package/dist/ui/SelectionObserver.js +3 -29
  169. package/dist/ui/TableCellMenu.js +3 -18
  170. package/dist/ui/TableGridSizeEditor.js +5 -51
  171. package/dist/ui/TableNodeView.js +0 -11
  172. package/dist/ui/bindScrollHandler.js +2 -9
  173. package/dist/ui/canUseCSSFont.js +2 -8
  174. package/dist/ui/czi-icon.css +4 -4
  175. package/dist/ui/findActiveFontSize.js +2 -18
  176. package/dist/ui/findActiveFontType.js +0 -12
  177. package/dist/ui/handleEditorDrop.js +0 -9
  178. package/dist/ui/handleEditorKeyDown.js +0 -7
  179. package/dist/ui/handleEditorPaste.js +0 -9
  180. package/dist/ui/htmlElementToRect.js +0 -4
  181. package/dist/ui/injectStyleSheet.js +0 -10
  182. package/dist/ui/isElementFullyVisible.js +2 -8
  183. package/dist/ui/isOffline.js +0 -2
  184. package/dist/ui/isReactClass.js +0 -4
  185. package/dist/ui/mathquill-editor/MathQuillEditor.js +9 -44
  186. package/dist/ui/mathquill-editor/MathQuillEditorSymbols.js +1 -3
  187. package/dist/ui/mathquill-editor/MathQuillEditorSymbolsPanel.js +3 -16
  188. package/dist/ui/mathquill-editor/mathquill-import-kludge.js +5 -7
  189. package/dist/ui/renderLaTeXAsHTML.js +2 -13
  190. package/dist/ui/resolveImage.js +7 -32
  191. package/dist/ui/toCSSColor.js +0 -14
  192. package/dist/ui/toCSSLineSpacing.js +10 -11
  193. package/dist/ui/toHexColor.js +0 -8
  194. package/dist/ui/uuid.js +0 -2
  195. package/dist/uuid.js +0 -2
  196. package/licit/client/CustomLicitRuntime.js +30 -4
  197. package/package-lock.json.old +32889 -0
  198. package/package.json +45 -69
  199. package/src/client/Licit.js +16 -2
  200. package/src/ui/ImageNodeView.js +3 -3
  201. package/src/ui/czi-icon.css +4 -4
  202. package/utils/build_web_server.js +1 -7
  203. package/webpack.config.js +3 -3
package/.eslintrc.js CHANGED
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
- parser: 'babel-eslint',
2
+ parser: '@babel/eslint-parser',
3
3
  parserOptions: {
4
4
  sourceType: 'module',
5
5
  allowImportExportEverywhere: false,
package/README.md CHANGED
@@ -210,6 +210,7 @@ Please refer *licit\client\index.js* for getting more detailed idea on passing p
210
210
  |Method Name| Description|Parameter|
211
211
  |--|--|--|
212
212
  |setProps | Update properties of the editor using an editor instance |<ul><li>props: Licit properties' object</li></ul>
213
+ |insertJSON | Insert node at the current cursor position |<ul><li>json: Node</li></ul>
213
214
 
214
215
  To set data to editor:
215
216
 
@@ -4,72 +4,54 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _prosemirrorModel = require("prosemirror-model");
9
-
10
8
  var _prosemirrorState = require("prosemirror-state");
11
-
12
9
  var _prosemirrorTransform = require("prosemirror-transform");
13
-
14
10
  var _prosemirrorUtils = require("prosemirror-utils");
15
-
16
11
  var _prosemirrorView = require("prosemirror-view");
17
-
18
12
  var _NodeNames = require("./NodeNames");
19
-
20
13
  var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
21
-
22
- 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; }
23
-
14
+ 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; }
15
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
16
+ 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); }
24
17
  // This handles the case when user press SHIFT + ENTER key to insert a new line
25
18
  // into blockquote.
26
19
  function insertNewLine(tr, schema) {
27
20
  const {
28
21
  selection
29
22
  } = tr;
30
-
31
23
  if (!selection) {
32
24
  return tr;
33
25
  }
34
-
35
26
  const {
36
27
  from,
37
28
  empty
38
29
  } = selection;
39
-
40
30
  if (!empty) {
41
31
  return tr;
42
32
  }
43
-
44
33
  const br = schema.nodes[_NodeNames.HARD_BREAK];
45
-
46
34
  if (!br) {
47
35
  return tr;
48
36
  }
49
-
50
37
  const blockquote = schema.nodes[_NodeNames.BLOCKQUOTE];
51
38
  const result = (0, _prosemirrorUtils.findParentNodeOfType)(blockquote)(selection);
52
-
53
39
  if (!result) {
54
40
  return tr;
55
41
  }
56
-
57
42
  tr = tr.insert(from, _prosemirrorModel.Fragment.from(br.create()));
58
43
  tr = tr.setSelection(_prosemirrorState.TextSelection.create(tr.doc, from + 1, from + 1));
59
44
  return tr;
60
45
  }
61
-
62
46
  class BlockquoteInsertNewLineCommand extends _licitDocAttrsStep.UICommand {
63
47
  constructor() {
64
48
  super(...arguments);
65
-
66
49
  _defineProperty(this, "execute", (state, dispatch, view) => {
67
50
  const {
68
51
  schema,
69
52
  selection
70
53
  } = state;
71
54
  const tr = insertNewLine(state.tr.setSelection(selection), schema);
72
-
73
55
  if (tr.docChanged) {
74
56
  dispatch && dispatch(tr);
75
57
  return true;
@@ -78,8 +60,6 @@ class BlockquoteInsertNewLineCommand extends _licitDocAttrsStep.UICommand {
78
60
  }
79
61
  });
80
62
  }
81
-
82
63
  }
83
-
84
64
  var _default = BlockquoteInsertNewLineCommand;
85
65
  exports.default = _default;
@@ -4,23 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _prosemirrorModel = require("prosemirror-model");
9
-
10
8
  var _ParagraphNodeSpec = _interopRequireWildcard(require("./ParagraphNodeSpec"));
11
-
12
9
  var _Types = require("./Types");
13
-
14
10
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
-
16
11
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
-
18
12
  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; }
19
-
20
13
  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; }
21
-
22
- 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; }
23
-
14
+ 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; }
15
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
16
+ 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); }
24
17
  // https://github.com/ProseMirror/prosemirror-schema-basic/blob/master/src/schema-basic.js
25
18
  // :: NodeSpec A plain paragraph textblock. Represented in the DOM
26
19
  // as a `<p>` element.
@@ -32,16 +25,13 @@ const BlockquoteNodeSpec = _objectSpread(_objectSpread({}, _ParagraphNodeSpec.de
32
25
  }],
33
26
  toDOM
34
27
  });
35
-
36
28
  function toDOM(node) {
37
29
  const dom = (0, _ParagraphNodeSpec.toParagraphDOM)(node);
38
30
  dom[0] = 'blockquote';
39
31
  return dom;
40
32
  }
41
-
42
33
  function getAttrs(dom) {
43
34
  return (0, _ParagraphNodeSpec.getParagraphNodeAttrs)(dom);
44
35
  }
45
-
46
36
  var _default = BlockquoteNodeSpec;
47
37
  exports.default = _default;
@@ -4,41 +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 _prosemirrorUtils = require("prosemirror-utils");
13
-
14
10
  var _prosemirrorView = require("prosemirror-view");
15
-
16
11
  var _NodeNames = require("./NodeNames");
17
-
18
12
  var _toggleBlockquote = _interopRequireDefault(require("./toggleBlockquote"));
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
  class BlockquoteToggleCommand extends _licitDocAttrsStep.UICommand {
27
19
  constructor() {
28
20
  super(...arguments);
29
-
30
21
  _defineProperty(this, "isActive", state => {
31
22
  const blockquote = state.schema.nodes[_NodeNames.BLOCKQUOTE];
32
23
  return !!(blockquote && (0, _prosemirrorUtils.findParentNodeOfType)(blockquote)(state.selection));
33
24
  });
34
-
35
25
  _defineProperty(this, "execute", (state, dispatch, view) => {
36
26
  const {
37
27
  schema,
38
28
  selection
39
29
  } = state;
40
30
  const tr = (0, _toggleBlockquote.default)(state.tr.setSelection(selection), schema);
41
-
42
31
  if (tr.docChanged) {
43
32
  dispatch && dispatch(tr);
44
33
  return true;
@@ -47,8 +36,6 @@ class BlockquoteToggleCommand extends _licitDocAttrsStep.UICommand {
47
36
  }
48
37
  });
49
38
  }
50
-
51
39
  }
52
-
53
40
  var _default = BlockquoteToggleCommand;
54
41
  exports.default = _default;
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports.ATTRIBUTE_BOOKMARK_VISIBLE = exports.ATTRIBUTE_BOOKMARK_ID = void 0;
7
-
8
7
  var _Types = require("./Types");
9
-
10
8
  const ATTRIBUTE_BOOKMARK_ID = 'data-bookmark-id';
11
9
  exports.ATTRIBUTE_BOOKMARK_ID = ATTRIBUTE_BOOKMARK_ID;
12
10
  const ATTRIBUTE_BOOKMARK_VISIBLE = 'data-bookmark-visible';
13
11
  exports.ATTRIBUTE_BOOKMARK_VISIBLE = ATTRIBUTE_BOOKMARK_VISIBLE;
14
-
15
12
  function getAttrs(dom) {
16
13
  const id = dom.getAttribute(ATTRIBUTE_BOOKMARK_ID);
17
14
  const visible = dom.getAttribute(ATTRIBUTE_BOOKMARK_VISIBLE) === 'true';
@@ -20,7 +17,6 @@ function getAttrs(dom) {
20
17
  visible
21
18
  };
22
19
  }
23
-
24
20
  const BookmarkNodeSpec = {
25
21
  inline: true,
26
22
  attrs: {
@@ -37,7 +33,6 @@ const BookmarkNodeSpec = {
37
33
  tag: `a[${ATTRIBUTE_BOOKMARK_ID}]`,
38
34
  getAttrs
39
35
  }],
40
-
41
36
  toDOM(node) {
42
37
  const {
43
38
  id,
@@ -50,7 +45,6 @@ const BookmarkNodeSpec = {
50
45
  } : {};
51
46
  return ['a', attrs];
52
47
  }
53
-
54
48
  };
55
49
  var _default = BookmarkNodeSpec;
56
50
  exports.default = _default;
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _prosemirrorModel = require("prosemirror-model");
9
-
10
8
  var _ListItemNodeSpec = require("./ListItemNodeSpec");
11
-
12
9
  var _NodeNames = require("./NodeNames");
13
-
14
10
  var _ParagraphNodeSpec = require("./ParagraphNodeSpec");
15
-
16
11
  var _Types = require("./Types");
17
-
18
12
  const AUTO_LIST_STYLE_TYPES = ['disc', 'square', 'circle'];
19
13
  const BulletListNodeSpec = {
20
14
  attrs: {
@@ -32,7 +26,6 @@ const BulletListNodeSpec = {
32
26
  content: _NodeNames.LIST_ITEM + '+',
33
27
  parseDOM: [{
34
28
  tag: 'ul',
35
-
36
29
  getAttrs(dom) {
37
30
  const listStyleType = dom.getAttribute(_ListItemNodeSpec.ATTRIBUTE_LIST_STYLE_TYPE) || null;
38
31
  const indent = dom.hasAttribute(_ParagraphNodeSpec.ATTRIBUTE_INDENT) ? parseInt(dom.getAttribute(_ParagraphNodeSpec.ATTRIBUTE_INDENT), 10) : _ParagraphNodeSpec.MIN_INDENT_LEVEL;
@@ -41,33 +34,26 @@ const BulletListNodeSpec = {
41
34
  listStyleType
42
35
  };
43
36
  }
44
-
45
37
  }],
46
-
47
38
  toDOM(node) {
48
39
  const {
49
40
  indent,
50
41
  listStyleType
51
42
  } = node.attrs;
52
- const attrs = {}; // [FS] IRAD-947 2020-05-26
43
+ const attrs = {};
44
+ // [FS] IRAD-947 2020-05-26
53
45
  // Bullet list type changing fix
54
-
55
46
  attrs[_ParagraphNodeSpec.ATTRIBUTE_INDENT] = indent;
56
-
57
47
  if (listStyleType) {
58
48
  attrs[_ListItemNodeSpec.ATTRIBUTE_LIST_STYLE_TYPE] = listStyleType;
59
49
  }
60
-
61
50
  let htmlListStyleType = listStyleType;
62
-
63
51
  if (!htmlListStyleType || htmlListStyleType === 'disc') {
64
52
  htmlListStyleType = AUTO_LIST_STYLE_TYPES[indent % AUTO_LIST_STYLE_TYPES.length];
65
53
  }
66
-
67
54
  attrs.type = htmlListStyleType;
68
55
  return ['ul', attrs, 0];
69
56
  }
70
-
71
57
  };
72
58
  var _default = BulletListNodeSpec;
73
59
  exports.default = _default;
@@ -10,19 +10,15 @@ exports.registerCommand = registerCommand;
10
10
  exports.registerEditorView = registerEditorView;
11
11
  exports.registeryKeys = registeryKeys;
12
12
  exports.releaseEditorView = releaseEditorView;
13
-
14
13
  var _prosemirrorView = require("prosemirror-view");
15
-
16
14
  var _convertToJSON = _interopRequireDefault(require("./convertToJSON"));
17
-
18
15
  var _CustomEditorView = _interopRequireDefault(require("./ui/CustomEditorView"));
19
-
20
16
  var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
21
-
22
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
18
  const commandsRegistery = new Map();
25
- const viewsRegistery = new Map(); // This file exports methods to help developer to debug editor from web
19
+ const viewsRegistery = new Map();
20
+
21
+ // This file exports methods to help developer to debug editor from web
26
22
  // inspector. To use this, add the following lines to export the utility.
27
23
  //
28
24
  // import * as CZIProseMirror from 'czi-prosemirror/dist/CZIProseMirror';
@@ -31,60 +27,45 @@ const viewsRegistery = new Map(); // This file exports methods to help developer
31
27
  function registeryKeys() {
32
28
  return Array.from(viewsRegistery.keys());
33
29
  }
34
-
35
30
  function exportJSON(id) {
36
31
  if (!id && viewsRegistery.size) {
37
32
  id = registeryKeys()[0];
38
33
  console.log(`use default editor id "${id}"`);
39
34
  }
40
-
41
35
  const view = viewsRegistery.get(String(id));
42
-
43
36
  if (!view) {
44
37
  if (!id) {
45
38
  id = '';
46
39
  }
47
-
48
40
  throw new Error(`view ${id} does not exist`);
49
41
  }
50
-
51
42
  return (0, _convertToJSON.default)(view.state);
52
43
  }
53
-
54
44
  function registerEditorView(id, view) {
55
45
  if (viewsRegistery.has(id)) {
56
46
  throw new Error(`view ${id} already registered`);
57
47
  }
58
-
59
48
  if (!(view instanceof _CustomEditorView.default)) {
60
49
  throw new Error(`invalid view ${id}`);
61
50
  }
62
-
63
51
  if (!id) {
64
52
  throw new Error('id is required');
65
53
  }
66
-
67
54
  viewsRegistery.set(id, view);
68
55
  }
69
-
70
56
  function releaseEditorView(id) {
71
57
  if (!viewsRegistery.has(id)) {
72
58
  throw new Error(`view ${id} was released`);
73
59
  }
74
-
75
60
  viewsRegistery.delete(id);
76
61
  }
77
-
78
62
  function findEditorView(id) {
79
63
  return viewsRegistery.get(id) || null;
80
64
  }
81
-
82
65
  function executeCommand(name, viewID) {
83
66
  const command = commandsRegistery.get(name);
84
-
85
67
  if (command) {
86
68
  const view = viewID ? viewsRegistery.get(viewID) : Array.from(viewsRegistery.values())[0];
87
-
88
69
  if (view) {
89
70
  try {
90
71
  return command.execute(view.state, view.dispatch, view, null);
@@ -94,22 +75,17 @@ function executeCommand(name, viewID) {
94
75
  }
95
76
  }
96
77
  }
97
-
98
78
  return false;
99
79
  }
100
-
101
80
  function registerCommand(name, command) {
102
81
  if (!(command instanceof _licitDocAttrsStep.UICommand)) {
103
82
  throw new Error(`invalid command ${name}`);
104
83
  }
105
-
106
84
  if (!name) {
107
85
  throw new Error('invalid command name');
108
86
  }
109
-
110
87
  if (commandsRegistery.has(name)) {
111
88
  throw new Error(`command ${name} already registered`);
112
89
  }
113
-
114
90
  commandsRegistery.set(name, command);
115
91
  }
@@ -4,37 +4,25 @@ 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 _prosemirrorUtils = require("prosemirror-utils");
13
-
14
10
  var _prosemirrorView = require("prosemirror-view");
15
-
16
11
  var _NodeNames = require("./NodeNames");
17
-
18
12
  var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
19
-
20
13
  var _toggleCodeBlock = _interopRequireDefault(require("./toggleCodeBlock"));
21
-
22
14
  var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
23
-
24
15
  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
-
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); }
28
19
  class CodeBlockCommand extends _licitDocAttrsStep.UICommand {
29
20
  constructor() {
30
21
  super(...arguments);
31
-
32
22
  _defineProperty(this, "isActive", state => {
33
23
  const result = this._findCodeBlock(state);
34
-
35
24
  return !!(result && result.node);
36
25
  });
37
-
38
26
  _defineProperty(this, "execute", (state, dispatch, view) => {
39
27
  const {
40
28
  selection,
@@ -45,7 +33,6 @@ class CodeBlockCommand extends _licitDocAttrsStep.UICommand {
45
33
  } = state;
46
34
  tr = tr.setSelection(selection);
47
35
  tr = (0, _toggleCodeBlock.default)(tr, schema);
48
-
49
36
  if (tr.docChanged) {
50
37
  dispatch && dispatch(tr);
51
38
  return true;
@@ -54,14 +41,11 @@ class CodeBlockCommand extends _licitDocAttrsStep.UICommand {
54
41
  }
55
42
  });
56
43
  }
57
-
58
44
  _findCodeBlock(state) {
59
45
  const codeBlock = state.schema.nodes[_NodeNames.CODE_BLOCK];
60
46
  const findCodeBlock = codeBlock ? (0, _prosemirrorUtils.findParentNodeOfType)(codeBlock) : _licitUiCommands.noop;
61
47
  return findCodeBlock(state.selection);
62
48
  }
63
-
64
49
  }
65
-
66
50
  var _default = CodeBlockCommand;
67
51
  exports.default = _default;
@@ -4,11 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- const PRE_DOM = ['pre', ['code', 0]]; // https://github.com/ProseMirror/prosemirror-schema-basic/blob/master/src/schema-basic.js
7
+ const PRE_DOM = ['pre', ['code', 0]];
8
+
9
+ // https://github.com/ProseMirror/prosemirror-schema-basic/blob/master/src/schema-basic.js
8
10
  // :: NodeSpec A code listing. Disallows marks or non-text inline
9
11
  // nodes by default. Represented as a `<pre>` element with a
10
12
  // `<code>` element inside of it.
11
-
12
13
  const CodeBlockNodeSpec = {
13
14
  attrs: {
14
15
  id: {
@@ -24,11 +25,9 @@ const CodeBlockNodeSpec = {
24
25
  tag: 'pre',
25
26
  preserveWhitespace: 'full'
26
27
  }],
27
-
28
28
  toDOM() {
29
29
  return PRE_DOM;
30
30
  }
31
-
32
31
  };
33
32
  var _default = CodeBlockNodeSpec;
34
33
  exports.default = _default;
@@ -4,19 +4,15 @@ 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 CODE_DOM = ['code', 0];
11
9
  const CodeMarkSpec = {
12
10
  parseDOM: [{
13
11
  tag: 'code'
14
12
  }],
15
-
16
13
  toDOM() {
17
14
  return CODE_DOM;
18
15
  }
19
-
20
16
  };
21
17
  var _default = CodeMarkSpec;
22
18
  exports.default = _default;