@modusoperandi/licit 1.0.12 → 1.1.1

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 = {
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Portions Copyright (c) 2020 Modus Operandi Inc
4
+ Portions Copyright (c) 2018-2019 Chan Zuckerberg Initiative
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -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) {
@@ -144,8 +144,8 @@ class LinkTooltipView {
144
144
  const styles = await stylePromise.fetchStyles();
145
145
 
146
146
  storeTOCvalue = styles
147
- .filter((style) => style.styles.toc === true)
148
- .map((style) => style.styleName);
147
+ .filter((style) => style?.styles?.toc === true)
148
+ .map((style) => style?.styleName);
149
149
  view.state.tr.doc.descendants((node, pos) => {
150
150
  if (node.attrs.styleName) {
151
151
  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 + '+',