@manuscripts/body-editor 1.6.10 → 1.6.12
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/dist/cjs/commands.js +57 -1
- package/dist/cjs/components/toolbar/LevelSelector.js +2 -2
- package/dist/cjs/index.js +4 -9
- package/dist/cjs/keys/list.js +9 -9
- package/dist/cjs/lib/context-menu.js +81 -163
- package/dist/cjs/menus.js +353 -405
- package/dist/cjs/toolbar.js +30 -34
- package/dist/cjs/views/editable_block.js +12 -4
- package/dist/es/commands.js +57 -2
- package/dist/es/components/toolbar/LevelSelector.js +2 -2
- package/dist/es/index.js +2 -4
- package/dist/es/keys/list.js +7 -7
- package/dist/es/lib/context-menu.js +81 -163
- package/dist/es/menus.js +353 -405
- package/dist/es/toolbar.js +31 -35
- package/dist/es/views/editable_block.js +13 -5
- package/dist/types/commands.d.ts +1 -0
- package/dist/types/components/toolbar/LevelSelector.d.ts +2 -2
- package/dist/types/configs/editor-views.d.ts +14 -14
- package/dist/types/index.d.ts +2 -4
- package/dist/types/keys/list.d.ts +1 -1
- package/dist/types/lib/context-menu.d.ts +0 -7
- package/dist/types/menus.d.ts +2 -3
- package/dist/types/toolbar.d.ts +18 -1
- package/dist/types/views/bibliography_element_editable.d.ts +1 -1
- package/dist/types/views/blockquote_element_editable.d.ts +1 -1
- package/dist/types/views/bullet_list_editable.d.ts +1 -1
- package/dist/types/views/editable_block.d.ts +1 -1
- package/dist/types/views/equation_element_editable.d.ts +1 -1
- package/dist/types/views/figure_element_editable.d.ts +1 -1
- package/dist/types/views/footnote_editable.d.ts +1 -1
- package/dist/types/views/footnotes_element_editable.d.ts +1 -1
- package/dist/types/views/listing_element_editable.d.ts +1 -1
- package/dist/types/views/ordered_list_editable.d.ts +1 -1
- package/dist/types/views/paragraph_editable.d.ts +1 -1
- package/dist/types/views/placeholder_element_editable.d.ts +1 -1
- package/dist/types/views/pullquote_element_editable.d.ts +1 -1
- package/dist/types/views/section_title_editable.d.ts +1 -1
- package/dist/types/views/table_element_editable.d.ts +1 -1
- package/dist/types/views/toc_element_editable.d.ts +1 -1
- package/package.json +3 -5
- package/dist/cjs/components/application-menu/ApplicationMenu.js +0 -63
- package/dist/cjs/components/application-menu/MenuItemContainer.js +0 -127
- package/dist/cjs/components/application-menu/Shortcut.js +0 -63
- package/dist/cjs/components/application-menu/index.js +0 -22
- package/dist/cjs/components/application-menu/menuState.js +0 -49
- package/dist/cjs/components/application-menu/types.js +0 -17
- package/dist/cjs/components/application-menu/useApplicationMenus.js +0 -154
- package/dist/cjs/components/dialog/TableCellBorderOptions.js +0 -64
- package/dist/cjs/components/dialog/TableCellOptions.js +0 -50
- package/dist/cjs/components/dialog/TableOptions.js +0 -31
- package/dist/cjs/components/dialog/commands.js +0 -185
- package/dist/cjs/components/dialog/index.js +0 -26
- package/dist/cjs/components/dialog/shared.js +0 -48
- package/dist/cjs/components/dialog/types.js +0 -9
- package/dist/cjs/components/toolbar/ListStyleSelector.js +0 -150
- package/dist/cjs/components/toolbar/ManuscriptToolbar.js +0 -104
- package/dist/cjs/components/toolbar/OrderListSelector.js +0 -103
- package/dist/cjs/views/EditableBlock.js +0 -37
- package/dist/es/components/application-menu/ApplicationMenu.js +0 -56
- package/dist/es/components/application-menu/MenuItemContainer.js +0 -120
- package/dist/es/components/application-menu/Shortcut.js +0 -56
- package/dist/es/components/application-menu/index.js +0 -17
- package/dist/es/components/application-menu/menuState.js +0 -44
- package/dist/es/components/application-menu/types.js +0 -16
- package/dist/es/components/application-menu/useApplicationMenus.js +0 -148
- package/dist/es/components/dialog/TableCellBorderOptions.js +0 -36
- package/dist/es/components/dialog/TableCellOptions.js +0 -22
- package/dist/es/components/dialog/TableOptions.js +0 -26
- package/dist/es/components/dialog/commands.js +0 -177
- package/dist/es/components/dialog/index.js +0 -18
- package/dist/es/components/dialog/shared.js +0 -21
- package/dist/es/components/dialog/types.js +0 -6
- package/dist/es/components/toolbar/ListStyleSelector.js +0 -120
- package/dist/es/components/toolbar/ManuscriptToolbar.js +0 -97
- package/dist/es/components/toolbar/OrderListSelector.js +0 -72
- package/dist/es/views/EditableBlock.js +0 -29
- package/dist/types/components/application-menu/ApplicationMenu.d.ts +0 -24
- package/dist/types/components/application-menu/MenuItemContainer.d.ts +0 -27
- package/dist/types/components/application-menu/Shortcut.d.ts +0 -26
- package/dist/types/components/application-menu/index.d.ts +0 -18
- package/dist/types/components/application-menu/menuState.d.ts +0 -18
- package/dist/types/components/application-menu/types.d.ts +0 -47
- package/dist/types/components/application-menu/useApplicationMenus.d.ts +0 -12
- package/dist/types/components/dialog/TableCellBorderOptions.d.ts +0 -9
- package/dist/types/components/dialog/TableCellOptions.d.ts +0 -4
- package/dist/types/components/dialog/TableOptions.d.ts +0 -4
- package/dist/types/components/dialog/commands.d.ts +0 -28
- package/dist/types/components/dialog/index.d.ts +0 -4
- package/dist/types/components/dialog/shared.d.ts +0 -16
- package/dist/types/components/dialog/types.d.ts +0 -16
- package/dist/types/components/toolbar/ListStyleSelector.d.ts +0 -36
- package/dist/types/components/toolbar/ManuscriptToolbar.d.ts +0 -50
- package/dist/types/components/toolbar/OrderListSelector.d.ts +0 -14
- package/dist/types/views/EditableBlock.d.ts +0 -19
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { isInBibliographySection, nodeNames, schema, } from '@manuscripts/transform';
|
|
17
|
-
import { Fragment, Slice } from 'prosemirror-model';
|
|
18
17
|
import { addComment, createBlock } from '../commands';
|
|
19
18
|
import { PopperManager } from './popper';
|
|
20
19
|
const popper = new PopperManager();
|
|
@@ -28,118 +27,96 @@ export const sectionLevel = (depth) => {
|
|
|
28
27
|
return 'Sub' + 'sub'.repeat(depth - 2) + 'section';
|
|
29
28
|
}
|
|
30
29
|
};
|
|
30
|
+
const hasAny = (set, ...items) => {
|
|
31
|
+
return items.some((i) => set.has(i));
|
|
32
|
+
};
|
|
31
33
|
export class ContextMenu {
|
|
32
34
|
constructor(node, view, getPos, actions = {}) {
|
|
33
|
-
this.suppressibleAttrs = new Map([
|
|
34
|
-
['suppressHeader', 'Header'],
|
|
35
|
-
['suppressFooter', 'Footer'],
|
|
36
|
-
]);
|
|
37
35
|
this.showAddMenu = (target, after) => {
|
|
38
|
-
let _after = after;
|
|
39
|
-
const { nodes } = this.view.state.schema;
|
|
40
36
|
const menu = document.createElement('div');
|
|
41
37
|
menu.className = 'menu';
|
|
42
38
|
const $pos = this.resolvePos();
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
if (isInBibliographySection($pos)) {
|
|
40
|
+
after = false;
|
|
41
|
+
}
|
|
42
|
+
const insertPos = after ? $pos.after($pos.depth) : $pos.before($pos.depth);
|
|
45
43
|
const endPos = $pos.end();
|
|
46
|
-
const
|
|
47
|
-
|
|
44
|
+
const types = this.insertableTypes(after, insertPos, endPos);
|
|
45
|
+
const insertNode = (type, pos) => {
|
|
46
|
+
const { state, dispatch } = this.view;
|
|
47
|
+
if (pos === undefined) {
|
|
48
|
+
pos = after ? this.getPos() + this.node.nodeSize : this.getPos();
|
|
49
|
+
}
|
|
50
|
+
createBlock(type, pos, state, dispatch);
|
|
51
|
+
};
|
|
52
|
+
if (hasAny(types, 'section', 'subsection')) {
|
|
48
53
|
menu.appendChild(this.createMenuSection((section) => {
|
|
49
|
-
const labelPosition = _after ? 'After' : 'Before';
|
|
50
54
|
const sectionTitle = $pos.node($pos.depth).child(0).textContent;
|
|
51
55
|
const itemTitle = sectionTitle
|
|
52
56
|
? `“${this.trimTitle(sectionTitle, 30)}”`
|
|
53
57
|
: 'This Section';
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
if (types.has('section')) {
|
|
59
|
+
const labelPosition = after ? 'After' : 'Before';
|
|
60
|
+
const level = sectionLevel($pos.depth - 1);
|
|
61
|
+
const label = `New ${level} ${labelPosition} ${itemTitle}`;
|
|
62
|
+
section.appendChild(this.createMenuItem(label, () => {
|
|
63
|
+
insertNode(schema.nodes.section, insertPos);
|
|
58
64
|
popper.destroy();
|
|
59
65
|
}));
|
|
60
66
|
}
|
|
61
|
-
if (
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
if (types.has('subsection')) {
|
|
68
|
+
const level = sectionLevel($pos.depth);
|
|
69
|
+
const label = `New ${level} to ${itemTitle}`;
|
|
70
|
+
section.appendChild(this.createMenuItem(label, () => {
|
|
71
|
+
insertNode(schema.nodes.section, endPos);
|
|
65
72
|
popper.destroy();
|
|
66
73
|
}));
|
|
67
74
|
}
|
|
68
75
|
}));
|
|
69
76
|
}
|
|
70
|
-
if (
|
|
71
|
-
'paragraph',
|
|
72
|
-
'orderedList',
|
|
73
|
-
'bulletList',
|
|
74
|
-
])) {
|
|
77
|
+
if (hasAny(types, 'paragraph', 'ordered_list', 'bullet_list')) {
|
|
75
78
|
menu.appendChild(this.createMenuSection((section) => {
|
|
76
|
-
if (
|
|
79
|
+
if (types.has('paragraph')) {
|
|
77
80
|
section.appendChild(this.createMenuItem('Paragraph', () => {
|
|
78
|
-
|
|
81
|
+
insertNode(schema.nodes.paragraph);
|
|
79
82
|
popper.destroy();
|
|
80
83
|
}));
|
|
81
84
|
}
|
|
82
|
-
if (
|
|
85
|
+
if (types.has('ordered_list')) {
|
|
83
86
|
section.appendChild(this.createMenuItem('Numbered List', () => {
|
|
84
|
-
|
|
87
|
+
insertNode(schema.nodes.ordered_list);
|
|
85
88
|
popper.destroy();
|
|
86
89
|
}));
|
|
87
90
|
}
|
|
88
|
-
if (
|
|
91
|
+
if (types.has('bullet_list')) {
|
|
89
92
|
section.appendChild(this.createMenuItem('Bullet List', () => {
|
|
90
|
-
|
|
93
|
+
insertNode(schema.nodes.bullet_list);
|
|
91
94
|
popper.destroy();
|
|
92
95
|
}));
|
|
93
96
|
}
|
|
94
97
|
}));
|
|
95
98
|
}
|
|
96
|
-
if (
|
|
97
|
-
'figure',
|
|
98
|
-
'tableElement',
|
|
99
|
-
'equationElement',
|
|
100
|
-
'listingElement',
|
|
101
|
-
])) {
|
|
99
|
+
if (hasAny(types, 'figure_element', 'equation_element')) {
|
|
102
100
|
menu.appendChild(this.createMenuSection((section) => {
|
|
103
|
-
if (
|
|
101
|
+
if (types.has('figure_element')) {
|
|
104
102
|
section.appendChild(this.createMenuItem('Figure Panel', () => {
|
|
105
|
-
|
|
103
|
+
insertNode(schema.nodes.figure_element);
|
|
106
104
|
popper.destroy();
|
|
107
105
|
}));
|
|
108
106
|
}
|
|
109
|
-
if (
|
|
110
|
-
section.appendChild(this.createMenuItem('Table', () => {
|
|
111
|
-
this.addBlock(nodes.table_element, _after);
|
|
112
|
-
popper.destroy();
|
|
113
|
-
}));
|
|
114
|
-
}
|
|
115
|
-
if (insertableTypes.equationElement) {
|
|
107
|
+
if (types.has('equation_element')) {
|
|
116
108
|
section.appendChild(this.createMenuItem('Equation', () => {
|
|
117
|
-
|
|
118
|
-
popper.destroy();
|
|
119
|
-
}));
|
|
120
|
-
}
|
|
121
|
-
if (insertableTypes.listingElement) {
|
|
122
|
-
section.appendChild(this.createMenuItem('Listing', () => {
|
|
123
|
-
this.addBlock(nodes.listing_element, _after);
|
|
109
|
+
insertNode(schema.nodes.equation_element);
|
|
124
110
|
popper.destroy();
|
|
125
111
|
}));
|
|
126
112
|
}
|
|
127
113
|
}));
|
|
128
114
|
}
|
|
129
|
-
if (
|
|
130
|
-
'blockquoteElement',
|
|
131
|
-
'pullquoteElement',
|
|
132
|
-
])) {
|
|
115
|
+
if (hasAny(types, 'blockquote_element')) {
|
|
133
116
|
menu.appendChild(this.createMenuSection((section) => {
|
|
134
|
-
if (
|
|
117
|
+
if (types.has('blockquote_element')) {
|
|
135
118
|
section.appendChild(this.createMenuItem('Block Quote', () => {
|
|
136
|
-
|
|
137
|
-
popper.destroy();
|
|
138
|
-
}));
|
|
139
|
-
}
|
|
140
|
-
if (insertableTypes.pullquoteElement) {
|
|
141
|
-
section.appendChild(this.createMenuItem('Pull Quote', () => {
|
|
142
|
-
this.addBlock(nodes.pullquote_element, _after);
|
|
119
|
+
insertNode(schema.nodes.blockquote_element);
|
|
143
120
|
popper.destroy();
|
|
144
121
|
}));
|
|
145
122
|
}
|
|
@@ -156,19 +133,18 @@ export class ContextMenu {
|
|
|
156
133
|
const menu = document.createElement('div');
|
|
157
134
|
menu.className = 'menu';
|
|
158
135
|
const $pos = this.resolvePos();
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
if (listTypes.includes(nodeType)) {
|
|
136
|
+
const type = this.node.type;
|
|
137
|
+
if (listTypes.includes(type)) {
|
|
162
138
|
menu.appendChild(this.createMenuSection((section) => {
|
|
163
|
-
if (
|
|
139
|
+
if (type === schema.nodes.bullet_list) {
|
|
164
140
|
section.appendChild(this.createMenuItem('Change to Numbered List', () => {
|
|
165
|
-
this.changeNodeType(nodes.ordered_list);
|
|
141
|
+
this.changeNodeType(schema.nodes.ordered_list);
|
|
166
142
|
popper.destroy();
|
|
167
143
|
}));
|
|
168
144
|
}
|
|
169
|
-
if (
|
|
145
|
+
if (type === schema.nodes.ordered_list) {
|
|
170
146
|
section.appendChild(this.createMenuItem('Change to Bullet List', () => {
|
|
171
|
-
this.changeNodeType(nodes.bullet_list);
|
|
147
|
+
this.changeNodeType(schema.nodes.bullet_list);
|
|
172
148
|
popper.destroy();
|
|
173
149
|
}));
|
|
174
150
|
}
|
|
@@ -184,34 +160,12 @@ export class ContextMenu {
|
|
|
184
160
|
}));
|
|
185
161
|
}));
|
|
186
162
|
}
|
|
187
|
-
|
|
188
|
-
if (suppressOptions.length) {
|
|
189
|
-
menu.appendChild(this.createMenuSection((section) => {
|
|
190
|
-
for (const option of suppressOptions) {
|
|
191
|
-
const label = option.attrs[option.attr]
|
|
192
|
-
? `Show ${option.label}`
|
|
193
|
-
: `Hide ${option.label}`;
|
|
194
|
-
section.appendChild(this.createMenuItem(label, () => {
|
|
195
|
-
this.toggleNodeAttr(option);
|
|
196
|
-
popper.destroy();
|
|
197
|
-
}));
|
|
198
|
-
}
|
|
199
|
-
}));
|
|
200
|
-
}
|
|
201
|
-
if (nodeType === nodes.paragraph && $pos.parent.type === nodes.section) {
|
|
202
|
-
menu.appendChild(this.createMenuSection((section) => {
|
|
203
|
-
section.appendChild(this.createMenuItem(`Split to New ${sectionLevel($pos.depth)}`, () => {
|
|
204
|
-
this.splitSection();
|
|
205
|
-
popper.destroy();
|
|
206
|
-
}));
|
|
207
|
-
}));
|
|
208
|
-
}
|
|
209
|
-
if (!readonlyTypes.includes(nodeType) &&
|
|
163
|
+
if (!readonlyTypes.includes(type) &&
|
|
210
164
|
!readonlyTypes.includes($pos.parent.type)) {
|
|
211
165
|
menu.appendChild(this.createMenuSection((section) => {
|
|
212
|
-
const nodeName = nodeNames.get(
|
|
166
|
+
const nodeName = nodeNames.get(type) || '';
|
|
213
167
|
section.appendChild(this.createMenuItem(`Delete ${nodeName}`, () => {
|
|
214
|
-
this.deleteNode(
|
|
168
|
+
this.deleteNode(type);
|
|
215
169
|
popper.destroy();
|
|
216
170
|
}));
|
|
217
171
|
}));
|
|
@@ -223,22 +177,6 @@ export class ContextMenu {
|
|
|
223
177
|
});
|
|
224
178
|
this.addPopperEventListeners();
|
|
225
179
|
};
|
|
226
|
-
this.addBlock = (nodeType, after, position) => {
|
|
227
|
-
const { state, dispatch } = this.view;
|
|
228
|
-
if (position === undefined) {
|
|
229
|
-
position = after ? this.getPos() + this.node.nodeSize : this.getPos();
|
|
230
|
-
}
|
|
231
|
-
createBlock(nodeType, position, state, dispatch);
|
|
232
|
-
};
|
|
233
|
-
this.canAddBlock = (nodeType, after, position) => {
|
|
234
|
-
const { state: { doc }, } = this.view;
|
|
235
|
-
if (position === undefined) {
|
|
236
|
-
position = after ? this.getPos() + this.node.nodeSize : this.getPos();
|
|
237
|
-
}
|
|
238
|
-
const $position = doc.resolve(position);
|
|
239
|
-
const index = $position.index();
|
|
240
|
-
return $position.parent.canReplaceWith(index, index, nodeType);
|
|
241
|
-
};
|
|
242
180
|
this.createMenuItem = (contents, handler) => {
|
|
243
181
|
const item = document.createElement('div');
|
|
244
182
|
item.className = 'menu-item';
|
|
@@ -256,22 +194,37 @@ export class ContextMenu {
|
|
|
256
194
|
return section;
|
|
257
195
|
};
|
|
258
196
|
this.insertableTypes = (after, insertPos, endPos) => {
|
|
259
|
-
const { nodes } =
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
197
|
+
const { nodes } = schema;
|
|
198
|
+
const insertable = new Set();
|
|
199
|
+
const doc = this.view.state.doc;
|
|
200
|
+
const getPos = (pos) => {
|
|
201
|
+
if (pos === undefined) {
|
|
202
|
+
pos = after ? this.getPos() + this.node.nodeSize : this.getPos();
|
|
203
|
+
}
|
|
204
|
+
return pos;
|
|
205
|
+
};
|
|
206
|
+
const canInsertAt = (type, pos) => {
|
|
207
|
+
const $pos = doc.resolve(getPos(pos));
|
|
208
|
+
const index = $pos.index();
|
|
209
|
+
return $pos.parent.canReplaceWith(index, index, type);
|
|
210
|
+
};
|
|
211
|
+
const checkNode = (node, pos) => {
|
|
212
|
+
canInsertAt(nodes[node], pos) && insertable.add(node);
|
|
272
213
|
};
|
|
214
|
+
if (canInsertAt(nodes.section, endPos)) {
|
|
215
|
+
insertable.add('subsection');
|
|
216
|
+
}
|
|
217
|
+
checkNode('section', insertPos);
|
|
218
|
+
checkNode('paragraph');
|
|
219
|
+
checkNode('ordered_list');
|
|
220
|
+
checkNode('bullet_list');
|
|
221
|
+
checkNode('figure_element');
|
|
222
|
+
checkNode('table_element');
|
|
223
|
+
checkNode('equation_element');
|
|
224
|
+
checkNode('blockquote_element');
|
|
225
|
+
checkNode('pullquote_element');
|
|
226
|
+
return insertable;
|
|
273
227
|
};
|
|
274
|
-
this.showMenuSection = (insertableTypes, types) => types.some((type) => insertableTypes[type]);
|
|
275
228
|
this.changeNodeType = (nodeType) => {
|
|
276
229
|
this.view.dispatch(this.view.state.tr.setNodeMarkup(this.getPos(), nodeType, {
|
|
277
230
|
id: this.node.attrs.id,
|
|
@@ -300,41 +253,6 @@ export class ContextMenu {
|
|
|
300
253
|
}
|
|
301
254
|
};
|
|
302
255
|
this.resolvePos = () => this.view.state.doc.resolve(this.getPos());
|
|
303
|
-
this.splitSection = () => {
|
|
304
|
-
const { schema, tr } = this.view.state;
|
|
305
|
-
const from = this.getPos();
|
|
306
|
-
const to = from + this.node.nodeSize;
|
|
307
|
-
const slice = new Slice(Fragment.from([
|
|
308
|
-
schema.nodes.section.create(),
|
|
309
|
-
schema.nodes.section.create({}, [
|
|
310
|
-
schema.nodes.section_title.create(),
|
|
311
|
-
this.node,
|
|
312
|
-
]),
|
|
313
|
-
]), 1, 1);
|
|
314
|
-
this.view.dispatch(tr.replaceRange(from, to, slice));
|
|
315
|
-
};
|
|
316
|
-
this.toggleNodeAttr = (option) => {
|
|
317
|
-
const { getPos, attr, attrs } = option;
|
|
318
|
-
this.view.dispatch(this.view.state.tr.setNodeMarkup(getPos(), undefined, Object.assign(Object.assign({}, attrs), { [attr]: !attrs[attr] })));
|
|
319
|
-
};
|
|
320
|
-
this.buildSuppressOptions = () => {
|
|
321
|
-
const items = [];
|
|
322
|
-
let attrs = this.node.attrs;
|
|
323
|
-
if (this.node.attrs.suppressTitle === undefined) {
|
|
324
|
-
attrs = Object.assign(this.node.attrs, { suppressTitle: false });
|
|
325
|
-
}
|
|
326
|
-
for (const [attr, label] of this.suppressibleAttrs.entries()) {
|
|
327
|
-
if (attr in attrs) {
|
|
328
|
-
items.push({
|
|
329
|
-
attr,
|
|
330
|
-
attrs,
|
|
331
|
-
label,
|
|
332
|
-
getPos: this.getPos,
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
return items;
|
|
337
|
-
};
|
|
338
256
|
this.addPopperEventListeners = () => {
|
|
339
257
|
const mouseListener = () => {
|
|
340
258
|
window.requestAnimationFrame(() => {
|
|
@@ -352,7 +270,7 @@ export class ContextMenu {
|
|
|
352
270
|
window.addEventListener('keydown', keyListener);
|
|
353
271
|
};
|
|
354
272
|
this.trimTitle = (title, max) => {
|
|
355
|
-
return title.length > max ? title.
|
|
273
|
+
return title.length > max ? title.substring(0, max) + '…' : title;
|
|
356
274
|
};
|
|
357
275
|
this.node = node;
|
|
358
276
|
this.view = view;
|