@modusoperandi/licit 1.1.0 → 1.1.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.
@@ -28,10 +28,6 @@ var RESOLVED_FONT_NAMES = new Set([]);
28
28
  function loadAndCacheFont(name) {
29
29
  // Cache custom fonts
30
30
  RESOLVED_FONT_NAMES.add(name);
31
- // https://github.com/typekit/webfontloader
32
- // [FS] IRAD-1061 2020-09-19
33
- // Now loaded locally, so that it work in closed network as well.
34
- //WebFontLoader.load({google: {families: [name]}});
35
31
  }
36
32
  var FontTypeMarkSpec = {
37
33
  attrs: {
@@ -41,10 +41,6 @@ const RESOLVED_FONT_NAMES = new Set([]);
41
41
  function loadAndCacheFont(name) {
42
42
  // Cache custom fonts
43
43
  RESOLVED_FONT_NAMES.add(name);
44
- // https://github.com/typekit/webfontloader
45
- // [FS] IRAD-1061 2020-09-19
46
- // Now loaded locally, so that it work in closed network as well.
47
- //WebFontLoader.load({google: {families: [name]}});
48
44
  }
49
45
 
50
46
  const FontTypeMarkSpec: MarkSpec = {
@@ -67,9 +67,10 @@ var LinkSetURLCommand = /*#__PURE__*/function (_UICommand) {
67
67
  case 7:
68
68
  styles = _context.sent;
69
69
  storeTOCvalue = styles.filter(function (style) {
70
- return style.styles.toc === true;
70
+ var _style$styles;
71
+ return (style === null || style === void 0 || (_style$styles = style.styles) === null || _style$styles === void 0 ? void 0 : _style$styles.toc) === true;
71
72
  }).map(function (style) {
72
- return style.styleName;
73
+ return style === null || style === void 0 ? void 0 : style.styleName;
73
74
  });
74
75
  view.state.tr.doc.descendants(function (node, pos) {
75
76
  if (node.attrs.styleName) {
@@ -146,9 +147,10 @@ var LinkSetURLCommand = /*#__PURE__*/function (_UICommand) {
146
147
  }());
147
148
  _defineProperty(_this, "executeWithUserInput", function (state, dispatch, view, url) {
148
149
  if (dispatch) {
149
- var selection = state.selection,
150
- schema = state.schema;
151
- var _tr = state.tr;
150
+ var _view$state = view.state,
151
+ selection = _view$state.selection,
152
+ schema = _view$state.schema;
153
+ var _tr = view.state.tr;
152
154
  _tr = view ? hideSelectionPlaceholder(view.state) : _tr;
153
155
  _tr = _tr.setSelection(selection);
154
156
  if (url !== undefined) {
@@ -166,7 +168,7 @@ var LinkSetURLCommand = /*#__PURE__*/function (_UICommand) {
166
168
  href: href,
167
169
  selectionId: selectionId
168
170
  } : null;
169
- _tr = applyMark(_tr.setSelection(state.selection), schema, markType, attrs);
171
+ _tr = applyMark(_tr.setSelection(selection), schema, markType, attrs);
170
172
  }
171
173
  dispatch(_tr);
172
174
  }
@@ -10,12 +10,12 @@ import {
10
10
  showSelectionPlaceholder,
11
11
  } from './SelectionPlaceholderPlugin.js';
12
12
  import {
13
- applyMark, findNodesWithSameMark, createPopUp
13
+ applyMark,
14
+ findNodesWithSameMark,
15
+ createPopUp,
14
16
  } from '@modusoperandi/licit-ui-commands';
15
17
  import LinkURLEditor from './ui/LinkURLEditor.js';
16
- import {
17
- UICommand
18
- } from '@modusoperandi/licit-doc-attrs-step';
18
+ import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
19
19
  import { INNER_LINK } from './Types.js';
20
20
 
21
21
  class LinkSetURLCommand extends UICommand {
@@ -47,8 +47,8 @@ class LinkSetURLCommand extends UICommand {
47
47
  const styles = await stylePromise.fetchStyles();
48
48
 
49
49
  storeTOCvalue = styles
50
- .filter((style) => style.styles.toc === true)
51
- .map((style) => style.styleName);
50
+ .filter((style) => style?.styles?.toc === true)
51
+ .map((style) => style?.styleName);
52
52
 
53
53
  view.state.tr.doc.descendants((node, pos) => {
54
54
  if (node.attrs.styleName) {
@@ -108,8 +108,8 @@ class LinkSetURLCommand extends UICommand {
108
108
  url: ?string
109
109
  ): boolean => {
110
110
  if (dispatch) {
111
- const { selection, schema } = state;
112
- let { tr } = state;
111
+ const { selection, schema } = view.state;
112
+ let { tr } = view.state;
113
113
  tr = view ? hideSelectionPlaceholder(view.state) : tr;
114
114
  tr = tr.setSelection(selection);
115
115
  if (url !== undefined) {
@@ -124,12 +124,7 @@ class LinkSetURLCommand extends UICommand {
124
124
  }
125
125
  const markType = schema.marks[MARK_LINK];
126
126
  const attrs = url ? { href, selectionId } : null;
127
- tr = applyMark(
128
- tr.setSelection(state.selection),
129
- schema,
130
- markType,
131
- attrs
132
- );
127
+ tr = applyMark(tr.setSelection(selection), schema, markType, attrs);
133
128
  }
134
129
  dispatch(tr);
135
130
  }
@@ -78,9 +78,10 @@ var LinkTooltipView = /*#__PURE__*/function () {
78
78
  case 9:
79
79
  styles = _context.sent;
80
80
  storeTOCvalue = styles.filter(function (style) {
81
- return style.styles.toc === true;
81
+ var _style$styles;
82
+ return (style === null || style === void 0 || (_style$styles = style.styles) === null || _style$styles === void 0 ? void 0 : _style$styles.toc) === true;
82
83
  }).map(function (style) {
83
- return style.styleName;
84
+ return style === null || style === void 0 ? void 0 : style.styleName;
84
85
  });
85
86
  view.state.tr.doc.descendants(function (node, pos) {
86
87
  if (node.attrs.styleName) {
@@ -204,10 +205,6 @@ var LinkTooltipView = /*#__PURE__*/function () {
204
205
  }, {
205
206
  key: "update",
206
207
  value: function update(view, lastState) {
207
- if (view.readOnly) {
208
- this.destroy();
209
- return;
210
- }
211
208
  var state = view.state;
212
209
  var doc = state.doc,
213
210
  selection = state.selection,
@@ -59,11 +59,6 @@ class LinkTooltipView {
59
59
  }
60
60
 
61
61
  update(view: EditorView, lastState: EditorState): void {
62
- if (view.readOnly) {
63
- this.destroy();
64
- return;
65
- }
66
-
67
62
  const { state } = view;
68
63
  const { doc, selection, schema } = state;
69
64
  const markType = schema.marks[MARK_LINK];
@@ -144,8 +139,8 @@ class LinkTooltipView {
144
139
  const styles = await stylePromise.fetchStyles();
145
140
 
146
141
  storeTOCvalue = styles
147
- .filter((style) => style.styles.toc === true)
148
- .map((style) => style.styleName);
142
+ .filter((style) => style?.styles?.toc === true)
143
+ .map((style) => style?.styleName);
149
144
  view.state.tr.doc.descendants((node, pos) => {
150
145
  if (node.attrs.styleName) {
151
146
  for (let i = 0; i <= storeTOCvalue.length; i++) {
@@ -34,9 +34,6 @@ var OrderedListNodeSpec = {
34
34
  },
35
35
  type: {
36
36
  "default": 'decimal'
37
- },
38
- styleName: {
39
- "default": RESERVED_STYLE_NONE
40
37
  }
41
38
  },
42
39
  group: 'block',
@@ -21,8 +21,7 @@ const OrderedListNodeSpec: NodeSpec = {
21
21
  listStyleType: { default: null },
22
22
  name: { default: null },
23
23
  start: { default: 1 },
24
- type: { default: 'decimal' },
25
- styleName: { default: RESERVED_STYLE_NONE },
24
+ type: { default: 'decimal' }
26
25
  },
27
26
  group: 'block',
28
27
  content: LIST_ITEM + '+',