prosemirror-menu 1.1.0 → 1.1.4
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/CHANGELOG.md +26 -0
- package/README.md +2 -2
- package/dist/index.es.js +638 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/rollup.config.js +9 -7
- package/src/menu.js +1 -5
- package/src/menubar.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
## 1.1.4 (2020-03-12)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Restore compatibility with IE11.
|
|
6
|
+
|
|
7
|
+
## 1.1.3 (2020-03-04)
|
|
8
|
+
|
|
9
|
+
### Bug fixes
|
|
10
|
+
|
|
11
|
+
Update crel dependency to a version that exposes an ES module.
|
|
12
|
+
|
|
13
|
+
## 1.1.2 (2019-12-02)
|
|
14
|
+
|
|
15
|
+
### Bug fixes
|
|
16
|
+
|
|
17
|
+
Downgrade a dependency so that the package can run in IE11 again.
|
|
18
|
+
|
|
19
|
+
## 1.1.1 (2019-11-20)
|
|
20
|
+
|
|
21
|
+
### Bug fixes
|
|
22
|
+
|
|
23
|
+
The file referred to in the package's `module` field now is compiled down to ES5.
|
|
24
|
+
|
|
25
|
+
Rename ES module files to use a .js extension, since Webpack gets confused by .mjs
|
|
26
|
+
|
|
1
27
|
## 1.1.0 (2019-11-08)
|
|
2
28
|
|
|
3
29
|
### New features
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# prosemirror-menu
|
|
2
2
|
|
|
3
|
-
[ [**WEBSITE**](
|
|
3
|
+
[ [**WEBSITE**](https://prosemirror.net) | [**ISSUES**](https://github.com/prosemirror/prosemirror-menu/issues) | [**FORUM**](https://discuss.prosemirror.net) | [**GITTER**](https://gitter.im/ProseMirror/prosemirror) ]
|
|
4
4
|
|
|
5
|
-
This is a non-core example module for [ProseMirror](
|
|
5
|
+
This is a non-core example module for [ProseMirror](https://prosemirror.net).
|
|
6
6
|
ProseMirror is a well-behaved rich semantic content editor based on
|
|
7
7
|
contentEditable, with support for collaborative editing and custom
|
|
8
8
|
document schemas.
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,638 @@
|
|
|
1
|
+
import crel from 'crelt';
|
|
2
|
+
import { joinUp, lift, selectParentNode, setBlockType, wrapIn } from 'prosemirror-commands';
|
|
3
|
+
import { undo, redo } from 'prosemirror-history';
|
|
4
|
+
import { Plugin } from 'prosemirror-state';
|
|
5
|
+
|
|
6
|
+
var SVG = "http://www.w3.org/2000/svg";
|
|
7
|
+
var XLINK = "http://www.w3.org/1999/xlink";
|
|
8
|
+
|
|
9
|
+
var prefix = "ProseMirror-icon";
|
|
10
|
+
|
|
11
|
+
function hashPath(path) {
|
|
12
|
+
var hash = 0;
|
|
13
|
+
for (var i = 0; i < path.length; i++)
|
|
14
|
+
{ hash = (((hash << 5) - hash) + path.charCodeAt(i)) | 0; }
|
|
15
|
+
return hash
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function getIcon(icon) {
|
|
19
|
+
var node = document.createElement("div");
|
|
20
|
+
node.className = prefix;
|
|
21
|
+
if (icon.path) {
|
|
22
|
+
var name = "pm-icon-" + hashPath(icon.path).toString(16);
|
|
23
|
+
if (!document.getElementById(name)) { buildSVG(name, icon); }
|
|
24
|
+
var svg = node.appendChild(document.createElementNS(SVG, "svg"));
|
|
25
|
+
svg.style.width = (icon.width / icon.height) + "em";
|
|
26
|
+
var use = svg.appendChild(document.createElementNS(SVG, "use"));
|
|
27
|
+
use.setAttributeNS(XLINK, "href", /([^#]*)/.exec(document.location)[1] + "#" + name);
|
|
28
|
+
} else if (icon.dom) {
|
|
29
|
+
node.appendChild(icon.dom.cloneNode(true));
|
|
30
|
+
} else {
|
|
31
|
+
node.appendChild(document.createElement("span")).textContent = icon.text || '';
|
|
32
|
+
if (icon.css) { node.firstChild.style.cssText = icon.css; }
|
|
33
|
+
}
|
|
34
|
+
return node
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function buildSVG(name, data) {
|
|
38
|
+
var collection = document.getElementById(prefix + "-collection");
|
|
39
|
+
if (!collection) {
|
|
40
|
+
collection = document.createElementNS(SVG, "svg");
|
|
41
|
+
collection.id = prefix + "-collection";
|
|
42
|
+
collection.style.display = "none";
|
|
43
|
+
document.body.insertBefore(collection, document.body.firstChild);
|
|
44
|
+
}
|
|
45
|
+
var sym = document.createElementNS(SVG, "symbol");
|
|
46
|
+
sym.id = name;
|
|
47
|
+
sym.setAttribute("viewBox", "0 0 " + data.width + " " + data.height);
|
|
48
|
+
var path = sym.appendChild(document.createElementNS(SVG, "path"));
|
|
49
|
+
path.setAttribute("d", data.path);
|
|
50
|
+
collection.appendChild(sym);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var prefix$1 = "ProseMirror-menu";
|
|
54
|
+
|
|
55
|
+
// ::- An icon or label that, when clicked, executes a command.
|
|
56
|
+
var MenuItem = function MenuItem(spec) {
|
|
57
|
+
// :: MenuItemSpec
|
|
58
|
+
// The spec used to create the menu item.
|
|
59
|
+
this.spec = spec;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// :: (EditorView) → {dom: dom.Node, update: (EditorState) → bool}
|
|
63
|
+
// Renders the icon according to its [display
|
|
64
|
+
// spec](#menu.MenuItemSpec.display), and adds an event handler which
|
|
65
|
+
// executes the command when the representation is clicked.
|
|
66
|
+
MenuItem.prototype.render = function render (view) {
|
|
67
|
+
var spec = this.spec;
|
|
68
|
+
var dom = spec.render ? spec.render(view)
|
|
69
|
+
: spec.icon ? getIcon(spec.icon)
|
|
70
|
+
: spec.label ? crel("div", null, translate(view, spec.label))
|
|
71
|
+
: null;
|
|
72
|
+
if (!dom) { throw new RangeError("MenuItem without icon or label property") }
|
|
73
|
+
if (spec.title) {
|
|
74
|
+
var title = (typeof spec.title === "function" ? spec.title(view.state) : spec.title);
|
|
75
|
+
dom.setAttribute("title", translate(view, title));
|
|
76
|
+
}
|
|
77
|
+
if (spec.class) { dom.classList.add(spec.class); }
|
|
78
|
+
if (spec.css) { dom.style.cssText += spec.css; }
|
|
79
|
+
|
|
80
|
+
dom.addEventListener("mousedown", function (e) {
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
if (!dom.classList.contains(prefix$1 + "-disabled"))
|
|
83
|
+
{ spec.run(view.state, view.dispatch, view, e); }
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
function update(state) {
|
|
87
|
+
if (spec.select) {
|
|
88
|
+
var selected = spec.select(state);
|
|
89
|
+
dom.style.display = selected ? "" : "none";
|
|
90
|
+
if (!selected) { return false }
|
|
91
|
+
}
|
|
92
|
+
var enabled = true;
|
|
93
|
+
if (spec.enable) {
|
|
94
|
+
enabled = spec.enable(state) || false;
|
|
95
|
+
setClass(dom, prefix$1 + "-disabled", !enabled);
|
|
96
|
+
}
|
|
97
|
+
if (spec.active) {
|
|
98
|
+
var active = enabled && spec.active(state) || false;
|
|
99
|
+
setClass(dom, prefix$1 + "-active", active);
|
|
100
|
+
}
|
|
101
|
+
return true
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return {dom: dom, update: update}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
function translate(view, text) {
|
|
108
|
+
return view._props.translate ? view._props.translate(text) : text
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// MenuItemSpec:: interface
|
|
112
|
+
// The configuration object passed to the `MenuItem` constructor.
|
|
113
|
+
//
|
|
114
|
+
// run:: (EditorState, (Transaction), EditorView, dom.Event)
|
|
115
|
+
// The function to execute when the menu item is activated.
|
|
116
|
+
//
|
|
117
|
+
// select:: ?(EditorState) → bool
|
|
118
|
+
// Optional function that is used to determine whether the item is
|
|
119
|
+
// appropriate at the moment. Deselected items will be hidden.
|
|
120
|
+
//
|
|
121
|
+
// enable:: ?(EditorState) → bool
|
|
122
|
+
// Function that is used to determine if the item is enabled. If
|
|
123
|
+
// given and returning false, the item will be given a disabled
|
|
124
|
+
// styling.
|
|
125
|
+
//
|
|
126
|
+
// active:: ?(EditorState) → bool
|
|
127
|
+
// A predicate function to determine whether the item is 'active' (for
|
|
128
|
+
// example, the item for toggling the strong mark might be active then
|
|
129
|
+
// the cursor is in strong text).
|
|
130
|
+
//
|
|
131
|
+
// render:: ?(EditorView) → dom.Node
|
|
132
|
+
// A function that renders the item. You must provide either this,
|
|
133
|
+
// [`icon`](#menu.MenuItemSpec.icon), or [`label`](#MenuItemSpec.label).
|
|
134
|
+
//
|
|
135
|
+
// icon:: ?Object
|
|
136
|
+
// Describes an icon to show for this item. The object may specify
|
|
137
|
+
// an SVG icon, in which case its `path` property should be an [SVG
|
|
138
|
+
// path
|
|
139
|
+
// spec](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d),
|
|
140
|
+
// and `width` and `height` should provide the viewbox in which that
|
|
141
|
+
// path exists. Alternatively, it may have a `text` property
|
|
142
|
+
// specifying a string of text that makes up the icon, with an
|
|
143
|
+
// optional `css` property giving additional CSS styling for the
|
|
144
|
+
// text. _Or_ it may contain `dom` property containing a DOM node.
|
|
145
|
+
//
|
|
146
|
+
// label:: ?string
|
|
147
|
+
// Makes the item show up as a text label. Mostly useful for items
|
|
148
|
+
// wrapped in a [drop-down](#menu.Dropdown) or similar menu. The object
|
|
149
|
+
// should have a `label` property providing the text to display.
|
|
150
|
+
//
|
|
151
|
+
// title:: ?union<string, (EditorState) → string>
|
|
152
|
+
// Defines DOM title (mouseover) text for the item.
|
|
153
|
+
//
|
|
154
|
+
// class:: ?string
|
|
155
|
+
// Optionally adds a CSS class to the item's DOM representation.
|
|
156
|
+
//
|
|
157
|
+
// css:: ?string
|
|
158
|
+
// Optionally adds a string of inline CSS to the item's DOM
|
|
159
|
+
// representation.
|
|
160
|
+
|
|
161
|
+
var lastMenuEvent = {time: 0, node: null};
|
|
162
|
+
function markMenuEvent(e) {
|
|
163
|
+
lastMenuEvent.time = Date.now();
|
|
164
|
+
lastMenuEvent.node = e.target;
|
|
165
|
+
}
|
|
166
|
+
function isMenuEvent(wrapper) {
|
|
167
|
+
return Date.now() - 100 < lastMenuEvent.time &&
|
|
168
|
+
lastMenuEvent.node && wrapper.contains(lastMenuEvent.node)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// ::- A drop-down menu, displayed as a label with a downwards-pointing
|
|
172
|
+
// triangle to the right of it.
|
|
173
|
+
var Dropdown = function Dropdown(content, options) {
|
|
174
|
+
this.options = options || {};
|
|
175
|
+
this.content = Array.isArray(content) ? content : [content];
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// :: (EditorView) → {dom: dom.Node, update: (EditorState)}
|
|
179
|
+
// Render the dropdown menu and sub-items.
|
|
180
|
+
Dropdown.prototype.render = function render (view) {
|
|
181
|
+
var this$1 = this;
|
|
182
|
+
|
|
183
|
+
var content = renderDropdownItems(this.content, view);
|
|
184
|
+
|
|
185
|
+
var label = crel("div", {class: prefix$1 + "-dropdown " + (this.options.class || ""),
|
|
186
|
+
style: this.options.css},
|
|
187
|
+
translate(view, this.options.label));
|
|
188
|
+
if (this.options.title) { label.setAttribute("title", translate(view, this.options.title)); }
|
|
189
|
+
var wrap = crel("div", {class: prefix$1 + "-dropdown-wrap"}, label);
|
|
190
|
+
var open = null, listeningOnClose = null;
|
|
191
|
+
var close = function () {
|
|
192
|
+
if (open && open.close()) {
|
|
193
|
+
open = null;
|
|
194
|
+
window.removeEventListener("mousedown", listeningOnClose);
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
label.addEventListener("mousedown", function (e) {
|
|
198
|
+
e.preventDefault();
|
|
199
|
+
markMenuEvent(e);
|
|
200
|
+
if (open) {
|
|
201
|
+
close();
|
|
202
|
+
} else {
|
|
203
|
+
open = this$1.expand(wrap, content.dom);
|
|
204
|
+
window.addEventListener("mousedown", listeningOnClose = function () {
|
|
205
|
+
if (!isMenuEvent(wrap)) { close(); }
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
function update(state) {
|
|
211
|
+
var inner = content.update(state);
|
|
212
|
+
wrap.style.display = inner ? "" : "none";
|
|
213
|
+
return inner
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return {dom: wrap, update: update}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
Dropdown.prototype.expand = function expand (dom, items) {
|
|
220
|
+
var menuDOM = crel("div", {class: prefix$1 + "-dropdown-menu " + (this.options.class || "")}, items);
|
|
221
|
+
|
|
222
|
+
var done = false;
|
|
223
|
+
function close() {
|
|
224
|
+
if (done) { return }
|
|
225
|
+
done = true;
|
|
226
|
+
dom.removeChild(menuDOM);
|
|
227
|
+
return true
|
|
228
|
+
}
|
|
229
|
+
dom.appendChild(menuDOM);
|
|
230
|
+
return {close: close, node: menuDOM}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
function renderDropdownItems(items, view) {
|
|
234
|
+
var rendered = [], updates = [];
|
|
235
|
+
for (var i = 0; i < items.length; i++) {
|
|
236
|
+
var ref = items[i].render(view);
|
|
237
|
+
var dom = ref.dom;
|
|
238
|
+
var update = ref.update;
|
|
239
|
+
rendered.push(crel("div", {class: prefix$1 + "-dropdown-item"}, dom));
|
|
240
|
+
updates.push(update);
|
|
241
|
+
}
|
|
242
|
+
return {dom: rendered, update: combineUpdates(updates, rendered)}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function combineUpdates(updates, nodes) {
|
|
246
|
+
return function (state) {
|
|
247
|
+
var something = false;
|
|
248
|
+
for (var i = 0; i < updates.length; i++) {
|
|
249
|
+
var up = updates[i](state);
|
|
250
|
+
nodes[i].style.display = up ? "" : "none";
|
|
251
|
+
if (up) { something = true; }
|
|
252
|
+
}
|
|
253
|
+
return something
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// ::- Represents a submenu wrapping a group of elements that start
|
|
258
|
+
// hidden and expand to the right when hovered over or tapped.
|
|
259
|
+
var DropdownSubmenu = function DropdownSubmenu(content, options) {
|
|
260
|
+
this.options = options || {};
|
|
261
|
+
this.content = Array.isArray(content) ? content : [content];
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// :: (EditorView) → {dom: dom.Node, update: (EditorState) → bool}
|
|
265
|
+
// Renders the submenu.
|
|
266
|
+
DropdownSubmenu.prototype.render = function render (view) {
|
|
267
|
+
var items = renderDropdownItems(this.content, view);
|
|
268
|
+
|
|
269
|
+
var label = crel("div", {class: prefix$1 + "-submenu-label"}, translate(view, this.options.label));
|
|
270
|
+
var wrap = crel("div", {class: prefix$1 + "-submenu-wrap"}, label,
|
|
271
|
+
crel("div", {class: prefix$1 + "-submenu"}, items.dom));
|
|
272
|
+
var listeningOnClose = null;
|
|
273
|
+
label.addEventListener("mousedown", function (e) {
|
|
274
|
+
e.preventDefault();
|
|
275
|
+
markMenuEvent(e);
|
|
276
|
+
setClass(wrap, prefix$1 + "-submenu-wrap-active");
|
|
277
|
+
if (!listeningOnClose)
|
|
278
|
+
{ window.addEventListener("mousedown", listeningOnClose = function () {
|
|
279
|
+
if (!isMenuEvent(wrap)) {
|
|
280
|
+
wrap.classList.remove(prefix$1 + "-submenu-wrap-active");
|
|
281
|
+
window.removeEventListener("mousedown", listeningOnClose);
|
|
282
|
+
listeningOnClose = null;
|
|
283
|
+
}
|
|
284
|
+
}); }
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
function update(state) {
|
|
288
|
+
var inner = items.update(state);
|
|
289
|
+
wrap.style.display = inner ? "" : "none";
|
|
290
|
+
return inner
|
|
291
|
+
}
|
|
292
|
+
return {dom: wrap, update: update}
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
// :: (EditorView, [union<MenuElement, [MenuElement]>]) → {dom: ?dom.DocumentFragment, update: (EditorState) → bool}
|
|
296
|
+
// Render the given, possibly nested, array of menu elements into a
|
|
297
|
+
// document fragment, placing separators between them (and ensuring no
|
|
298
|
+
// superfluous separators appear when some of the groups turn out to
|
|
299
|
+
// be empty).
|
|
300
|
+
function renderGrouped(view, content) {
|
|
301
|
+
var result = document.createDocumentFragment();
|
|
302
|
+
var updates = [], separators = [];
|
|
303
|
+
for (var i = 0; i < content.length; i++) {
|
|
304
|
+
var items = content[i], localUpdates = [], localNodes = [];
|
|
305
|
+
for (var j = 0; j < items.length; j++) {
|
|
306
|
+
var ref = items[j].render(view);
|
|
307
|
+
var dom = ref.dom;
|
|
308
|
+
var update$1 = ref.update;
|
|
309
|
+
var span = crel("span", {class: prefix$1 + "item"}, dom);
|
|
310
|
+
result.appendChild(span);
|
|
311
|
+
localNodes.push(span);
|
|
312
|
+
localUpdates.push(update$1);
|
|
313
|
+
}
|
|
314
|
+
if (localUpdates.length) {
|
|
315
|
+
updates.push(combineUpdates(localUpdates, localNodes));
|
|
316
|
+
if (i < content.length - 1)
|
|
317
|
+
{ separators.push(result.appendChild(separator())); }
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function update(state) {
|
|
322
|
+
var something = false, needSep = false;
|
|
323
|
+
for (var i = 0; i < updates.length; i++) {
|
|
324
|
+
var hasContent = updates[i](state);
|
|
325
|
+
if (i) { separators[i - 1].style.display = needSep && hasContent ? "" : "none"; }
|
|
326
|
+
needSep = hasContent;
|
|
327
|
+
if (hasContent) { something = true; }
|
|
328
|
+
}
|
|
329
|
+
return something
|
|
330
|
+
}
|
|
331
|
+
return {dom: result, update: update}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function separator() {
|
|
335
|
+
return crel("span", {class: prefix$1 + "separator"})
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// :: Object
|
|
339
|
+
// A set of basic editor-related icons. Contains the properties
|
|
340
|
+
// `join`, `lift`, `selectParentNode`, `undo`, `redo`, `strong`, `em`,
|
|
341
|
+
// `code`, `link`, `bulletList`, `orderedList`, and `blockquote`, each
|
|
342
|
+
// holding an object that can be used as the `icon` option to
|
|
343
|
+
// `MenuItem`.
|
|
344
|
+
var icons = {
|
|
345
|
+
join: {
|
|
346
|
+
width: 800, height: 900,
|
|
347
|
+
path: "M0 75h800v125h-800z M0 825h800v-125h-800z M250 400h100v-100h100v100h100v100h-100v100h-100v-100h-100z"
|
|
348
|
+
},
|
|
349
|
+
lift: {
|
|
350
|
+
width: 1024, height: 1024,
|
|
351
|
+
path: "M219 310v329q0 7-5 12t-12 5q-8 0-13-5l-164-164q-5-5-5-13t5-13l164-164q5-5 13-5 7 0 12 5t5 12zM1024 749v109q0 7-5 12t-12 5h-987q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h987q7 0 12 5t5 12zM1024 530v109q0 7-5 12t-12 5h-621q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h621q7 0 12 5t5 12zM1024 310v109q0 7-5 12t-12 5h-621q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h621q7 0 12 5t5 12zM1024 91v109q0 7-5 12t-12 5h-987q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h987q7 0 12 5t5 12z"
|
|
352
|
+
},
|
|
353
|
+
selectParentNode: {text: "\u2b1a", css: "font-weight: bold"},
|
|
354
|
+
undo: {
|
|
355
|
+
width: 1024, height: 1024,
|
|
356
|
+
path: "M761 1024c113-206 132-520-313-509v253l-384-384 384-384v248c534-13 594 472 313 775z"
|
|
357
|
+
},
|
|
358
|
+
redo: {
|
|
359
|
+
width: 1024, height: 1024,
|
|
360
|
+
path: "M576 248v-248l384 384-384 384v-253c-446-10-427 303-313 509-280-303-221-789 313-775z"
|
|
361
|
+
},
|
|
362
|
+
strong: {
|
|
363
|
+
width: 805, height: 1024,
|
|
364
|
+
path: "M317 869q42 18 80 18 214 0 214-191 0-65-23-102-15-25-35-42t-38-26-46-14-48-6-54-1q-41 0-57 5 0 30-0 90t-0 90q0 4-0 38t-0 55 2 47 6 38zM309 442q24 4 62 4 46 0 81-7t62-25 42-51 14-81q0-40-16-70t-45-46-61-24-70-8q-28 0-74 7 0 28 2 86t2 86q0 15-0 45t-0 45q0 26 0 39zM0 950l1-53q8-2 48-9t60-15q4-6 7-15t4-19 3-18 1-21 0-19v-37q0-561-12-585-2-4-12-8t-25-6-28-4-27-2-17-1l-2-47q56-1 194-6t213-5q13 0 39 0t38 0q40 0 78 7t73 24 61 40 42 59 16 78q0 29-9 54t-22 41-36 32-41 25-48 22q88 20 146 76t58 141q0 57-20 102t-53 74-78 48-93 27-100 8q-25 0-75-1t-75-1q-60 0-175 6t-132 6z"
|
|
365
|
+
},
|
|
366
|
+
em: {
|
|
367
|
+
width: 585, height: 1024,
|
|
368
|
+
path: "M0 949l9-48q3-1 46-12t63-21q16-20 23-57 0-4 35-165t65-310 29-169v-14q-13-7-31-10t-39-4-33-3l10-58q18 1 68 3t85 4 68 1q27 0 56-1t69-4 56-3q-2 22-10 50-17 5-58 16t-62 19q-4 10-8 24t-5 22-4 26-3 24q-15 84-50 239t-44 203q-1 5-7 33t-11 51-9 47-3 32l0 10q9 2 105 17-1 25-9 56-6 0-18 0t-18 0q-16 0-49-5t-49-5q-78-1-117-1-29 0-81 5t-69 6z"
|
|
369
|
+
},
|
|
370
|
+
code: {
|
|
371
|
+
width: 896, height: 1024,
|
|
372
|
+
path: "M608 192l-96 96 224 224-224 224 96 96 288-320-288-320zM288 192l-288 320 288 320 96-96-224-224 224-224-96-96z"
|
|
373
|
+
},
|
|
374
|
+
link: {
|
|
375
|
+
width: 951, height: 1024,
|
|
376
|
+
path: "M832 694q0-22-16-38l-118-118q-16-16-38-16-24 0-41 18 1 1 10 10t12 12 8 10 7 14 2 15q0 22-16 38t-38 16q-8 0-15-2t-14-7-10-8-12-12-10-10q-18 17-18 41 0 22 16 38l117 118q15 15 38 15 22 0 38-14l84-83q16-16 16-38zM430 292q0-22-16-38l-117-118q-16-16-38-16-22 0-38 15l-84 83q-16 16-16 38 0 22 16 38l118 118q15 15 38 15 24 0 41-17-1-1-10-10t-12-12-8-10-7-14-2-15q0-22 16-38t38-16q8 0 15 2t14 7 10 8 12 12 10 10q18-17 18-41zM941 694q0 68-48 116l-84 83q-47 47-116 47-69 0-116-48l-117-118q-47-47-47-116 0-70 50-119l-50-50q-49 50-118 50-68 0-116-48l-118-118q-48-48-48-116t48-116l84-83q47-47 116-47 69 0 116 48l117 118q47 47 47 116 0 70-50 119l50 50q49-50 118-50 68 0 116 48l118 118q48 48 48 116z"
|
|
377
|
+
},
|
|
378
|
+
bulletList: {
|
|
379
|
+
width: 768, height: 896,
|
|
380
|
+
path: "M0 512h128v-128h-128v128zM0 256h128v-128h-128v128zM0 768h128v-128h-128v128zM256 512h512v-128h-512v128zM256 256h512v-128h-512v128zM256 768h512v-128h-512v128z"
|
|
381
|
+
},
|
|
382
|
+
orderedList: {
|
|
383
|
+
width: 768, height: 896,
|
|
384
|
+
path: "M320 512h448v-128h-448v128zM320 768h448v-128h-448v128zM320 128v128h448v-128h-448zM79 384h78v-256h-36l-85 23v50l43-2v185zM189 590c0-36-12-78-96-78-33 0-64 6-83 16l1 66c21-10 42-15 67-15s32 11 32 28c0 26-30 58-110 112v50h192v-67l-91 2c49-30 87-66 87-113l1-1z"
|
|
385
|
+
},
|
|
386
|
+
blockquote: {
|
|
387
|
+
width: 640, height: 896,
|
|
388
|
+
path: "M0 448v256h256v-256h-128c0 0 0-128 128-128v-128c0 0-256 0-256 256zM640 320v-128c0 0-256 0-256 256v256h256v-256h-128c0 0 0-128 128-128z"
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
// :: MenuItem
|
|
393
|
+
// Menu item for the `joinUp` command.
|
|
394
|
+
var joinUpItem = new MenuItem({
|
|
395
|
+
title: "Join with above block",
|
|
396
|
+
run: joinUp,
|
|
397
|
+
select: function (state) { return joinUp(state); },
|
|
398
|
+
icon: icons.join
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
// :: MenuItem
|
|
402
|
+
// Menu item for the `lift` command.
|
|
403
|
+
var liftItem = new MenuItem({
|
|
404
|
+
title: "Lift out of enclosing block",
|
|
405
|
+
run: lift,
|
|
406
|
+
select: function (state) { return lift(state); },
|
|
407
|
+
icon: icons.lift
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
// :: MenuItem
|
|
411
|
+
// Menu item for the `selectParentNode` command.
|
|
412
|
+
var selectParentNodeItem = new MenuItem({
|
|
413
|
+
title: "Select parent node",
|
|
414
|
+
run: selectParentNode,
|
|
415
|
+
select: function (state) { return selectParentNode(state); },
|
|
416
|
+
icon: icons.selectParentNode
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
// :: MenuItem
|
|
420
|
+
// Menu item for the `undo` command.
|
|
421
|
+
var undoItem = new MenuItem({
|
|
422
|
+
title: "Undo last change",
|
|
423
|
+
run: undo,
|
|
424
|
+
enable: function (state) { return undo(state); },
|
|
425
|
+
icon: icons.undo
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
// :: MenuItem
|
|
429
|
+
// Menu item for the `redo` command.
|
|
430
|
+
var redoItem = new MenuItem({
|
|
431
|
+
title: "Redo last undone change",
|
|
432
|
+
run: redo,
|
|
433
|
+
enable: function (state) { return redo(state); },
|
|
434
|
+
icon: icons.redo
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
// :: (NodeType, Object) → MenuItem
|
|
438
|
+
// Build a menu item for wrapping the selection in a given node type.
|
|
439
|
+
// Adds `run` and `select` properties to the ones present in
|
|
440
|
+
// `options`. `options.attrs` may be an object or a function.
|
|
441
|
+
function wrapItem(nodeType, options) {
|
|
442
|
+
var passedOptions = {
|
|
443
|
+
run: function run(state, dispatch) {
|
|
444
|
+
// FIXME if (options.attrs instanceof Function) options.attrs(state, attrs => wrapIn(nodeType, attrs)(state))
|
|
445
|
+
return wrapIn(nodeType, options.attrs)(state, dispatch)
|
|
446
|
+
},
|
|
447
|
+
select: function select(state) {
|
|
448
|
+
return wrapIn(nodeType, options.attrs instanceof Function ? null : options.attrs)(state)
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
for (var prop in options) { passedOptions[prop] = options[prop]; }
|
|
452
|
+
return new MenuItem(passedOptions)
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// :: (NodeType, Object) → MenuItem
|
|
456
|
+
// Build a menu item for changing the type of the textblock around the
|
|
457
|
+
// selection to the given type. Provides `run`, `active`, and `select`
|
|
458
|
+
// properties. Others must be given in `options`. `options.attrs` may
|
|
459
|
+
// be an object to provide the attributes for the textblock node.
|
|
460
|
+
function blockTypeItem(nodeType, options) {
|
|
461
|
+
var command = setBlockType(nodeType, options.attrs);
|
|
462
|
+
var passedOptions = {
|
|
463
|
+
run: command,
|
|
464
|
+
enable: function enable(state) { return command(state) },
|
|
465
|
+
active: function active(state) {
|
|
466
|
+
var ref = state.selection;
|
|
467
|
+
var $from = ref.$from;
|
|
468
|
+
var to = ref.to;
|
|
469
|
+
var node = ref.node;
|
|
470
|
+
if (node) { return node.hasMarkup(nodeType, options.attrs) }
|
|
471
|
+
return to <= $from.end() && $from.parent.hasMarkup(nodeType, options.attrs)
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
for (var prop in options) { passedOptions[prop] = options[prop]; }
|
|
475
|
+
return new MenuItem(passedOptions)
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// Work around classList.toggle being broken in IE11
|
|
479
|
+
function setClass(dom, cls, on) {
|
|
480
|
+
if (on) { dom.classList.add(cls); }
|
|
481
|
+
else { dom.classList.remove(cls); }
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
var prefix$2 = "ProseMirror-menubar";
|
|
485
|
+
|
|
486
|
+
function isIOS() {
|
|
487
|
+
if (typeof navigator == "undefined") { return false }
|
|
488
|
+
var agent = navigator.userAgent;
|
|
489
|
+
return !/Edge\/\d/.test(agent) && /AppleWebKit/.test(agent) && /Mobile\/\w+/.test(agent)
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
// :: (Object) → Plugin
|
|
493
|
+
// A plugin that will place a menu bar above the editor. Note that
|
|
494
|
+
// this involves wrapping the editor in an additional `<div>`.
|
|
495
|
+
//
|
|
496
|
+
// options::-
|
|
497
|
+
// Supports the following options:
|
|
498
|
+
//
|
|
499
|
+
// content:: [[MenuElement]]
|
|
500
|
+
// Provides the content of the menu, as a nested array to be
|
|
501
|
+
// passed to `renderGrouped`.
|
|
502
|
+
//
|
|
503
|
+
// floating:: ?bool
|
|
504
|
+
// Determines whether the menu floats, i.e. whether it sticks to
|
|
505
|
+
// the top of the viewport when the editor is partially scrolled
|
|
506
|
+
// out of view.
|
|
507
|
+
function menuBar(options) {
|
|
508
|
+
return new Plugin({
|
|
509
|
+
view: function view(editorView) { return new MenuBarView(editorView, options) }
|
|
510
|
+
})
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
var MenuBarView = function MenuBarView(editorView, options) {
|
|
514
|
+
var this$1 = this;
|
|
515
|
+
|
|
516
|
+
this.editorView = editorView;
|
|
517
|
+
this.options = options;
|
|
518
|
+
|
|
519
|
+
this.wrapper = crel("div", {class: prefix$2 + "-wrapper"});
|
|
520
|
+
this.menu = this.wrapper.appendChild(crel("div", {class: prefix$2}));
|
|
521
|
+
this.menu.className = prefix$2;
|
|
522
|
+
this.spacer = null;
|
|
523
|
+
|
|
524
|
+
editorView.dom.parentNode.replaceChild(this.wrapper, editorView.dom);
|
|
525
|
+
this.wrapper.appendChild(editorView.dom);
|
|
526
|
+
|
|
527
|
+
this.maxHeight = 0;
|
|
528
|
+
this.widthForMaxHeight = 0;
|
|
529
|
+
this.floating = false;
|
|
530
|
+
|
|
531
|
+
var ref = renderGrouped(this.editorView, this.options.content);
|
|
532
|
+
var dom = ref.dom;
|
|
533
|
+
var update = ref.update;
|
|
534
|
+
this.contentUpdate = update;
|
|
535
|
+
this.menu.appendChild(dom);
|
|
536
|
+
this.update();
|
|
537
|
+
|
|
538
|
+
if (options.floating && !isIOS()) {
|
|
539
|
+
this.updateFloat();
|
|
540
|
+
var potentialScrollers = getAllWrapping(this.wrapper);
|
|
541
|
+
this.scrollFunc = function (e) {
|
|
542
|
+
var root = this$1.editorView.root;
|
|
543
|
+
if (!(root.body || root).contains(this$1.wrapper)) {
|
|
544
|
+
potentialScrollers.forEach(function (el) { return el.removeEventListener("scroll", this$1.scrollFunc); });
|
|
545
|
+
} else {
|
|
546
|
+
this$1.updateFloat(e.target.getBoundingClientRect && e.target);
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
potentialScrollers.forEach(function (el) { return el.addEventListener('scroll', this$1.scrollFunc); });
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
MenuBarView.prototype.update = function update () {
|
|
554
|
+
this.contentUpdate(this.editorView.state);
|
|
555
|
+
|
|
556
|
+
if (this.floating) {
|
|
557
|
+
this.updateScrollCursor();
|
|
558
|
+
} else {
|
|
559
|
+
if (this.menu.offsetWidth != this.widthForMaxHeight) {
|
|
560
|
+
this.widthForMaxHeight = this.menu.offsetWidth;
|
|
561
|
+
this.maxHeight = 0;
|
|
562
|
+
}
|
|
563
|
+
if (this.menu.offsetHeight > this.maxHeight) {
|
|
564
|
+
this.maxHeight = this.menu.offsetHeight;
|
|
565
|
+
this.menu.style.minHeight = this.maxHeight + "px";
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
MenuBarView.prototype.updateScrollCursor = function updateScrollCursor () {
|
|
571
|
+
var selection = this.editorView.root.getSelection();
|
|
572
|
+
if (!selection.focusNode) { return }
|
|
573
|
+
var rects = selection.getRangeAt(0).getClientRects();
|
|
574
|
+
var selRect = rects[selectionIsInverted(selection) ? 0 : rects.length - 1];
|
|
575
|
+
if (!selRect) { return }
|
|
576
|
+
var menuRect = this.menu.getBoundingClientRect();
|
|
577
|
+
if (selRect.top < menuRect.bottom && selRect.bottom > menuRect.top) {
|
|
578
|
+
var scrollable = findWrappingScrollable(this.wrapper);
|
|
579
|
+
if (scrollable) { scrollable.scrollTop -= (menuRect.bottom - selRect.top); }
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
MenuBarView.prototype.updateFloat = function updateFloat (scrollAncestor) {
|
|
584
|
+
var parent = this.wrapper, editorRect = parent.getBoundingClientRect(),
|
|
585
|
+
top = scrollAncestor ? Math.max(0, scrollAncestor.getBoundingClientRect().top) : 0;
|
|
586
|
+
|
|
587
|
+
if (this.floating) {
|
|
588
|
+
if (editorRect.top >= top || editorRect.bottom < this.menu.offsetHeight + 10) {
|
|
589
|
+
this.floating = false;
|
|
590
|
+
this.menu.style.position = this.menu.style.left = this.menu.style.top = this.menu.style.width = "";
|
|
591
|
+
this.menu.style.display = "";
|
|
592
|
+
this.spacer.parentNode.removeChild(this.spacer);
|
|
593
|
+
this.spacer = null;
|
|
594
|
+
} else {
|
|
595
|
+
var border = (parent.offsetWidth - parent.clientWidth) / 2;
|
|
596
|
+
this.menu.style.left = (editorRect.left + border) + "px";
|
|
597
|
+
this.menu.style.display = (editorRect.top > window.innerHeight ? "none" : "");
|
|
598
|
+
if (scrollAncestor) { this.menu.style.top = top + "px"; }
|
|
599
|
+
}
|
|
600
|
+
} else {
|
|
601
|
+
if (editorRect.top < top && editorRect.bottom >= this.menu.offsetHeight + 10) {
|
|
602
|
+
this.floating = true;
|
|
603
|
+
var menuRect = this.menu.getBoundingClientRect();
|
|
604
|
+
this.menu.style.left = menuRect.left + "px";
|
|
605
|
+
this.menu.style.width = menuRect.width + "px";
|
|
606
|
+
if (scrollAncestor) { this.menu.style.top = top + "px"; }
|
|
607
|
+
this.menu.style.position = "fixed";
|
|
608
|
+
this.spacer = crel("div", {class: prefix$2 + "-spacer", style: ("height: " + (menuRect.height) + "px")});
|
|
609
|
+
parent.insertBefore(this.spacer, this.menu);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
MenuBarView.prototype.destroy = function destroy () {
|
|
615
|
+
if (this.wrapper.parentNode)
|
|
616
|
+
{ this.wrapper.parentNode.replaceChild(this.editorView.dom, this.wrapper); }
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
// Not precise, but close enough
|
|
620
|
+
function selectionIsInverted(selection) {
|
|
621
|
+
if (selection.anchorNode == selection.focusNode) { return selection.anchorOffset > selection.focusOffset }
|
|
622
|
+
return selection.anchorNode.compareDocumentPosition(selection.focusNode) == Node.DOCUMENT_POSITION_FOLLOWING
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
function findWrappingScrollable(node) {
|
|
626
|
+
for (var cur = node.parentNode; cur; cur = cur.parentNode)
|
|
627
|
+
{ if (cur.scrollHeight > cur.clientHeight) { return cur } }
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
function getAllWrapping(node) {
|
|
631
|
+
var res = [window];
|
|
632
|
+
for (var cur = node.parentNode; cur; cur = cur.parentNode)
|
|
633
|
+
{ res.push(cur); }
|
|
634
|
+
return res
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
export { Dropdown, DropdownSubmenu, MenuItem, blockTypeItem, icons, joinUpItem, liftItem, menuBar, redoItem, renderGrouped, selectParentNodeItem, undoItem, wrapItem };
|
|
638
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/icons.js","../src/menu.js","../src/menubar.js"],"sourcesContent":["const SVG = \"http://www.w3.org/2000/svg\"\nconst XLINK = \"http://www.w3.org/1999/xlink\"\n\nconst prefix = \"ProseMirror-icon\"\n\nfunction hashPath(path) {\n let hash = 0\n for (let i = 0; i < path.length; i++)\n hash = (((hash << 5) - hash) + path.charCodeAt(i)) | 0\n return hash\n}\n\nexport function getIcon(icon) {\n let node = document.createElement(\"div\")\n node.className = prefix\n if (icon.path) {\n let name = \"pm-icon-\" + hashPath(icon.path).toString(16)\n if (!document.getElementById(name)) buildSVG(name, icon)\n let svg = node.appendChild(document.createElementNS(SVG, \"svg\"))\n svg.style.width = (icon.width / icon.height) + \"em\"\n let use = svg.appendChild(document.createElementNS(SVG, \"use\"))\n use.setAttributeNS(XLINK, \"href\", /([^#]*)/.exec(document.location)[1] + \"#\" + name)\n } else if (icon.dom) {\n node.appendChild(icon.dom.cloneNode(true))\n } else {\n node.appendChild(document.createElement(\"span\")).textContent = icon.text || ''\n if (icon.css) node.firstChild.style.cssText = icon.css\n }\n return node\n}\n\nfunction buildSVG(name, data) {\n let collection = document.getElementById(prefix + \"-collection\")\n if (!collection) {\n collection = document.createElementNS(SVG, \"svg\")\n collection.id = prefix + \"-collection\"\n collection.style.display = \"none\"\n document.body.insertBefore(collection, document.body.firstChild)\n }\n let sym = document.createElementNS(SVG, \"symbol\")\n sym.id = name\n sym.setAttribute(\"viewBox\", \"0 0 \" + data.width + \" \" + data.height)\n let path = sym.appendChild(document.createElementNS(SVG, \"path\"))\n path.setAttribute(\"d\", data.path)\n collection.appendChild(sym)\n}\n","import crel from \"crelt\"\nimport {lift, joinUp, selectParentNode, wrapIn, setBlockType} from \"prosemirror-commands\"\nimport {undo, redo} from \"prosemirror-history\"\n\nimport {getIcon} from \"./icons\"\n\nconst prefix = \"ProseMirror-menu\"\n\n// ::- An icon or label that, when clicked, executes a command.\nexport class MenuItem {\n // :: (MenuItemSpec)\n constructor(spec) {\n // :: MenuItemSpec\n // The spec used to create the menu item.\n this.spec = spec\n }\n\n // :: (EditorView) → {dom: dom.Node, update: (EditorState) → bool}\n // Renders the icon according to its [display\n // spec](#menu.MenuItemSpec.display), and adds an event handler which\n // executes the command when the representation is clicked.\n render(view) {\n let spec = this.spec\n let dom = spec.render ? spec.render(view)\n : spec.icon ? getIcon(spec.icon)\n : spec.label ? crel(\"div\", null, translate(view, spec.label))\n : null\n if (!dom) throw new RangeError(\"MenuItem without icon or label property\")\n if (spec.title) {\n const title = (typeof spec.title === \"function\" ? spec.title(view.state) : spec.title)\n dom.setAttribute(\"title\", translate(view, title))\n }\n if (spec.class) dom.classList.add(spec.class)\n if (spec.css) dom.style.cssText += spec.css\n\n dom.addEventListener(\"mousedown\", e => {\n e.preventDefault()\n if (!dom.classList.contains(prefix + \"-disabled\"))\n spec.run(view.state, view.dispatch, view, e)\n })\n\n function update(state) {\n if (spec.select) {\n let selected = spec.select(state)\n dom.style.display = selected ? \"\" : \"none\"\n if (!selected) return false\n }\n let enabled = true\n if (spec.enable) {\n enabled = spec.enable(state) || false\n setClass(dom, prefix + \"-disabled\", !enabled)\n }\n if (spec.active) {\n let active = enabled && spec.active(state) || false\n setClass(dom, prefix + \"-active\", active)\n }\n return true\n }\n\n return {dom, update}\n }\n}\n\nfunction translate(view, text) {\n return view._props.translate ? view._props.translate(text) : text\n}\n\n// MenuItemSpec:: interface\n// The configuration object passed to the `MenuItem` constructor.\n//\n// run:: (EditorState, (Transaction), EditorView, dom.Event)\n// The function to execute when the menu item is activated.\n//\n// select:: ?(EditorState) → bool\n// Optional function that is used to determine whether the item is\n// appropriate at the moment. Deselected items will be hidden.\n//\n// enable:: ?(EditorState) → bool\n// Function that is used to determine if the item is enabled. If\n// given and returning false, the item will be given a disabled\n// styling.\n//\n// active:: ?(EditorState) → bool\n// A predicate function to determine whether the item is 'active' (for\n// example, the item for toggling the strong mark might be active then\n// the cursor is in strong text).\n//\n// render:: ?(EditorView) → dom.Node\n// A function that renders the item. You must provide either this,\n// [`icon`](#menu.MenuItemSpec.icon), or [`label`](#MenuItemSpec.label).\n//\n// icon:: ?Object\n// Describes an icon to show for this item. The object may specify\n// an SVG icon, in which case its `path` property should be an [SVG\n// path\n// spec](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d),\n// and `width` and `height` should provide the viewbox in which that\n// path exists. Alternatively, it may have a `text` property\n// specifying a string of text that makes up the icon, with an\n// optional `css` property giving additional CSS styling for the\n// text. _Or_ it may contain `dom` property containing a DOM node.\n//\n// label:: ?string\n// Makes the item show up as a text label. Mostly useful for items\n// wrapped in a [drop-down](#menu.Dropdown) or similar menu. The object\n// should have a `label` property providing the text to display.\n//\n// title:: ?union<string, (EditorState) → string>\n// Defines DOM title (mouseover) text for the item.\n//\n// class:: ?string\n// Optionally adds a CSS class to the item's DOM representation.\n//\n// css:: ?string\n// Optionally adds a string of inline CSS to the item's DOM\n// representation.\n\nlet lastMenuEvent = {time: 0, node: null}\nfunction markMenuEvent(e) {\n lastMenuEvent.time = Date.now()\n lastMenuEvent.node = e.target\n}\nfunction isMenuEvent(wrapper) {\n return Date.now() - 100 < lastMenuEvent.time &&\n lastMenuEvent.node && wrapper.contains(lastMenuEvent.node)\n}\n\n// ::- A drop-down menu, displayed as a label with a downwards-pointing\n// triangle to the right of it.\nexport class Dropdown {\n // :: ([MenuElement], ?Object)\n // Create a dropdown wrapping the elements. Options may include\n // the following properties:\n //\n // **`label`**`: string`\n // : The label to show on the drop-down control.\n //\n // **`title`**`: string`\n // : Sets the\n // [`title`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/title)\n // attribute given to the menu control.\n //\n // **`class`**`: string`\n // : When given, adds an extra CSS class to the menu control.\n //\n // **`css`**`: string`\n // : When given, adds an extra set of CSS styles to the menu control.\n constructor(content, options) {\n this.options = options || {}\n this.content = Array.isArray(content) ? content : [content]\n }\n\n // :: (EditorView) → {dom: dom.Node, update: (EditorState)}\n // Render the dropdown menu and sub-items.\n render(view) {\n let content = renderDropdownItems(this.content, view)\n\n let label = crel(\"div\", {class: prefix + \"-dropdown \" + (this.options.class || \"\"),\n style: this.options.css},\n translate(view, this.options.label))\n if (this.options.title) label.setAttribute(\"title\", translate(view, this.options.title))\n let wrap = crel(\"div\", {class: prefix + \"-dropdown-wrap\"}, label)\n let open = null, listeningOnClose = null\n let close = () => {\n if (open && open.close()) {\n open = null\n window.removeEventListener(\"mousedown\", listeningOnClose)\n }\n }\n label.addEventListener(\"mousedown\", e => {\n e.preventDefault()\n markMenuEvent(e)\n if (open) {\n close()\n } else {\n open = this.expand(wrap, content.dom)\n window.addEventListener(\"mousedown\", listeningOnClose = () => {\n if (!isMenuEvent(wrap)) close()\n })\n }\n })\n\n function update(state) {\n let inner = content.update(state)\n wrap.style.display = inner ? \"\" : \"none\"\n return inner\n }\n\n return {dom: wrap, update}\n }\n\n expand(dom, items) {\n let menuDOM = crel(\"div\", {class: prefix + \"-dropdown-menu \" + (this.options.class || \"\")}, items)\n\n let done = false\n function close() {\n if (done) return\n done = true\n dom.removeChild(menuDOM)\n return true\n }\n dom.appendChild(menuDOM)\n return {close, node: menuDOM}\n }\n}\n\nfunction renderDropdownItems(items, view) {\n let rendered = [], updates = []\n for (let i = 0; i < items.length; i++) {\n let {dom, update} = items[i].render(view)\n rendered.push(crel(\"div\", {class: prefix + \"-dropdown-item\"}, dom))\n updates.push(update)\n }\n return {dom: rendered, update: combineUpdates(updates, rendered)}\n}\n\nfunction combineUpdates(updates, nodes) {\n return state => {\n let something = false\n for (let i = 0; i < updates.length; i++) {\n let up = updates[i](state)\n nodes[i].style.display = up ? \"\" : \"none\"\n if (up) something = true\n }\n return something\n }\n}\n\n// ::- Represents a submenu wrapping a group of elements that start\n// hidden and expand to the right when hovered over or tapped.\nexport class DropdownSubmenu {\n // :: ([MenuElement], ?Object)\n // Creates a submenu for the given group of menu elements. The\n // following options are recognized:\n //\n // **`label`**`: string`\n // : The label to show on the submenu.\n constructor(content, options) {\n this.options = options || {}\n this.content = Array.isArray(content) ? content : [content]\n }\n\n // :: (EditorView) → {dom: dom.Node, update: (EditorState) → bool}\n // Renders the submenu.\n render(view) {\n let items = renderDropdownItems(this.content, view)\n\n let label = crel(\"div\", {class: prefix + \"-submenu-label\"}, translate(view, this.options.label))\n let wrap = crel(\"div\", {class: prefix + \"-submenu-wrap\"}, label,\n crel(\"div\", {class: prefix + \"-submenu\"}, items.dom))\n let listeningOnClose = null\n label.addEventListener(\"mousedown\", e => {\n e.preventDefault()\n markMenuEvent(e)\n setClass(wrap, prefix + \"-submenu-wrap-active\")\n if (!listeningOnClose)\n window.addEventListener(\"mousedown\", listeningOnClose = () => {\n if (!isMenuEvent(wrap)) {\n wrap.classList.remove(prefix + \"-submenu-wrap-active\")\n window.removeEventListener(\"mousedown\", listeningOnClose)\n listeningOnClose = null\n }\n })\n })\n\n function update(state) {\n let inner = items.update(state)\n wrap.style.display = inner ? \"\" : \"none\"\n return inner\n }\n return {dom: wrap, update}\n }\n}\n\n// :: (EditorView, [union<MenuElement, [MenuElement]>]) → {dom: ?dom.DocumentFragment, update: (EditorState) → bool}\n// Render the given, possibly nested, array of menu elements into a\n// document fragment, placing separators between them (and ensuring no\n// superfluous separators appear when some of the groups turn out to\n// be empty).\nexport function renderGrouped(view, content) {\n let result = document.createDocumentFragment()\n let updates = [], separators = []\n for (let i = 0; i < content.length; i++) {\n let items = content[i], localUpdates = [], localNodes = []\n for (let j = 0; j < items.length; j++) {\n let {dom, update} = items[j].render(view)\n let span = crel(\"span\", {class: prefix + \"item\"}, dom)\n result.appendChild(span)\n localNodes.push(span)\n localUpdates.push(update)\n }\n if (localUpdates.length) {\n updates.push(combineUpdates(localUpdates, localNodes))\n if (i < content.length - 1)\n separators.push(result.appendChild(separator()))\n }\n }\n\n function update(state) {\n let something = false, needSep = false\n for (let i = 0; i < updates.length; i++) {\n let hasContent = updates[i](state)\n if (i) separators[i - 1].style.display = needSep && hasContent ? \"\" : \"none\"\n needSep = hasContent\n if (hasContent) something = true\n }\n return something\n }\n return {dom: result, update}\n}\n\nfunction separator() {\n return crel(\"span\", {class: prefix + \"separator\"})\n}\n\n// :: Object\n// A set of basic editor-related icons. Contains the properties\n// `join`, `lift`, `selectParentNode`, `undo`, `redo`, `strong`, `em`,\n// `code`, `link`, `bulletList`, `orderedList`, and `blockquote`, each\n// holding an object that can be used as the `icon` option to\n// `MenuItem`.\nexport const icons = {\n join: {\n width: 800, height: 900,\n path: \"M0 75h800v125h-800z M0 825h800v-125h-800z M250 400h100v-100h100v100h100v100h-100v100h-100v-100h-100z\"\n },\n lift: {\n width: 1024, height: 1024,\n path: \"M219 310v329q0 7-5 12t-12 5q-8 0-13-5l-164-164q-5-5-5-13t5-13l164-164q5-5 13-5 7 0 12 5t5 12zM1024 749v109q0 7-5 12t-12 5h-987q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h987q7 0 12 5t5 12zM1024 530v109q0 7-5 12t-12 5h-621q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h621q7 0 12 5t5 12zM1024 310v109q0 7-5 12t-12 5h-621q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h621q7 0 12 5t5 12zM1024 91v109q0 7-5 12t-12 5h-987q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h987q7 0 12 5t5 12z\"\n },\n selectParentNode: {text: \"\\u2b1a\", css: \"font-weight: bold\"},\n undo: {\n width: 1024, height: 1024,\n path: \"M761 1024c113-206 132-520-313-509v253l-384-384 384-384v248c534-13 594 472 313 775z\"\n },\n redo: {\n width: 1024, height: 1024,\n path: \"M576 248v-248l384 384-384 384v-253c-446-10-427 303-313 509-280-303-221-789 313-775z\"\n },\n strong: {\n width: 805, height: 1024,\n path: \"M317 869q42 18 80 18 214 0 214-191 0-65-23-102-15-25-35-42t-38-26-46-14-48-6-54-1q-41 0-57 5 0 30-0 90t-0 90q0 4-0 38t-0 55 2 47 6 38zM309 442q24 4 62 4 46 0 81-7t62-25 42-51 14-81q0-40-16-70t-45-46-61-24-70-8q-28 0-74 7 0 28 2 86t2 86q0 15-0 45t-0 45q0 26 0 39zM0 950l1-53q8-2 48-9t60-15q4-6 7-15t4-19 3-18 1-21 0-19v-37q0-561-12-585-2-4-12-8t-25-6-28-4-27-2-17-1l-2-47q56-1 194-6t213-5q13 0 39 0t38 0q40 0 78 7t73 24 61 40 42 59 16 78q0 29-9 54t-22 41-36 32-41 25-48 22q88 20 146 76t58 141q0 57-20 102t-53 74-78 48-93 27-100 8q-25 0-75-1t-75-1q-60 0-175 6t-132 6z\"\n },\n em: {\n width: 585, height: 1024,\n path: \"M0 949l9-48q3-1 46-12t63-21q16-20 23-57 0-4 35-165t65-310 29-169v-14q-13-7-31-10t-39-4-33-3l10-58q18 1 68 3t85 4 68 1q27 0 56-1t69-4 56-3q-2 22-10 50-17 5-58 16t-62 19q-4 10-8 24t-5 22-4 26-3 24q-15 84-50 239t-44 203q-1 5-7 33t-11 51-9 47-3 32l0 10q9 2 105 17-1 25-9 56-6 0-18 0t-18 0q-16 0-49-5t-49-5q-78-1-117-1-29 0-81 5t-69 6z\"\n },\n code: {\n width: 896, height: 1024,\n path: \"M608 192l-96 96 224 224-224 224 96 96 288-320-288-320zM288 192l-288 320 288 320 96-96-224-224 224-224-96-96z\"\n },\n link: {\n width: 951, height: 1024,\n path: \"M832 694q0-22-16-38l-118-118q-16-16-38-16-24 0-41 18 1 1 10 10t12 12 8 10 7 14 2 15q0 22-16 38t-38 16q-8 0-15-2t-14-7-10-8-12-12-10-10q-18 17-18 41 0 22 16 38l117 118q15 15 38 15 22 0 38-14l84-83q16-16 16-38zM430 292q0-22-16-38l-117-118q-16-16-38-16-22 0-38 15l-84 83q-16 16-16 38 0 22 16 38l118 118q15 15 38 15 24 0 41-17-1-1-10-10t-12-12-8-10-7-14-2-15q0-22 16-38t38-16q8 0 15 2t14 7 10 8 12 12 10 10q18-17 18-41zM941 694q0 68-48 116l-84 83q-47 47-116 47-69 0-116-48l-117-118q-47-47-47-116 0-70 50-119l-50-50q-49 50-118 50-68 0-116-48l-118-118q-48-48-48-116t48-116l84-83q47-47 116-47 69 0 116 48l117 118q47 47 47 116 0 70-50 119l50 50q49-50 118-50 68 0 116 48l118 118q48 48 48 116z\"\n },\n bulletList: {\n width: 768, height: 896,\n path: \"M0 512h128v-128h-128v128zM0 256h128v-128h-128v128zM0 768h128v-128h-128v128zM256 512h512v-128h-512v128zM256 256h512v-128h-512v128zM256 768h512v-128h-512v128z\"\n },\n orderedList: {\n width: 768, height: 896,\n path: \"M320 512h448v-128h-448v128zM320 768h448v-128h-448v128zM320 128v128h448v-128h-448zM79 384h78v-256h-36l-85 23v50l43-2v185zM189 590c0-36-12-78-96-78-33 0-64 6-83 16l1 66c21-10 42-15 67-15s32 11 32 28c0 26-30 58-110 112v50h192v-67l-91 2c49-30 87-66 87-113l1-1z\"\n },\n blockquote: {\n width: 640, height: 896,\n path: \"M0 448v256h256v-256h-128c0 0 0-128 128-128v-128c0 0-256 0-256 256zM640 320v-128c0 0-256 0-256 256v256h256v-256h-128c0 0 0-128 128-128z\"\n }\n}\n\n// :: MenuItem\n// Menu item for the `joinUp` command.\nexport const joinUpItem = new MenuItem({\n title: \"Join with above block\",\n run: joinUp,\n select: state => joinUp(state),\n icon: icons.join\n})\n\n// :: MenuItem\n// Menu item for the `lift` command.\nexport const liftItem = new MenuItem({\n title: \"Lift out of enclosing block\",\n run: lift,\n select: state => lift(state),\n icon: icons.lift\n})\n\n// :: MenuItem\n// Menu item for the `selectParentNode` command.\nexport const selectParentNodeItem = new MenuItem({\n title: \"Select parent node\",\n run: selectParentNode,\n select: state => selectParentNode(state),\n icon: icons.selectParentNode\n})\n\n// :: MenuItem\n// Menu item for the `undo` command.\nexport let undoItem = new MenuItem({\n title: \"Undo last change\",\n run: undo,\n enable: state => undo(state),\n icon: icons.undo\n})\n\n// :: MenuItem\n// Menu item for the `redo` command.\nexport let redoItem = new MenuItem({\n title: \"Redo last undone change\",\n run: redo,\n enable: state => redo(state),\n icon: icons.redo\n})\n\n// :: (NodeType, Object) → MenuItem\n// Build a menu item for wrapping the selection in a given node type.\n// Adds `run` and `select` properties to the ones present in\n// `options`. `options.attrs` may be an object or a function.\nexport function wrapItem(nodeType, options) {\n let passedOptions = {\n run(state, dispatch) {\n // FIXME if (options.attrs instanceof Function) options.attrs(state, attrs => wrapIn(nodeType, attrs)(state))\n return wrapIn(nodeType, options.attrs)(state, dispatch)\n },\n select(state) {\n return wrapIn(nodeType, options.attrs instanceof Function ? null : options.attrs)(state)\n }\n }\n for (let prop in options) passedOptions[prop] = options[prop]\n return new MenuItem(passedOptions)\n}\n\n// :: (NodeType, Object) → MenuItem\n// Build a menu item for changing the type of the textblock around the\n// selection to the given type. Provides `run`, `active`, and `select`\n// properties. Others must be given in `options`. `options.attrs` may\n// be an object to provide the attributes for the textblock node.\nexport function blockTypeItem(nodeType, options) {\n let command = setBlockType(nodeType, options.attrs)\n let passedOptions = {\n run: command,\n enable(state) { return command(state) },\n active(state) {\n let {$from, to, node} = state.selection\n if (node) return node.hasMarkup(nodeType, options.attrs)\n return to <= $from.end() && $from.parent.hasMarkup(nodeType, options.attrs)\n }\n }\n for (let prop in options) passedOptions[prop] = options[prop]\n return new MenuItem(passedOptions)\n}\n\n// Work around classList.toggle being broken in IE11\nfunction setClass(dom, cls, on) {\n if (on) dom.classList.add(cls)\n else dom.classList.remove(cls)\n}\n","import crel from \"crelt\"\nimport {Plugin} from \"prosemirror-state\"\n\nimport {renderGrouped} from \"./menu\"\n\nconst prefix = \"ProseMirror-menubar\"\n\nfunction isIOS() {\n if (typeof navigator == \"undefined\") return false\n let agent = navigator.userAgent\n return !/Edge\\/\\d/.test(agent) && /AppleWebKit/.test(agent) && /Mobile\\/\\w+/.test(agent)\n}\n\n// :: (Object) → Plugin\n// A plugin that will place a menu bar above the editor. Note that\n// this involves wrapping the editor in an additional `<div>`.\n//\n// options::-\n// Supports the following options:\n//\n// content:: [[MenuElement]]\n// Provides the content of the menu, as a nested array to be\n// passed to `renderGrouped`.\n//\n// floating:: ?bool\n// Determines whether the menu floats, i.e. whether it sticks to\n// the top of the viewport when the editor is partially scrolled\n// out of view.\nexport function menuBar(options) {\n return new Plugin({\n view(editorView) { return new MenuBarView(editorView, options) }\n })\n}\n\nclass MenuBarView {\n constructor(editorView, options) {\n this.editorView = editorView\n this.options = options\n\n this.wrapper = crel(\"div\", {class: prefix + \"-wrapper\"})\n this.menu = this.wrapper.appendChild(crel(\"div\", {class: prefix}))\n this.menu.className = prefix\n this.spacer = null\n\n editorView.dom.parentNode.replaceChild(this.wrapper, editorView.dom)\n this.wrapper.appendChild(editorView.dom)\n\n this.maxHeight = 0\n this.widthForMaxHeight = 0\n this.floating = false\n\n let {dom, update} = renderGrouped(this.editorView, this.options.content)\n this.contentUpdate = update\n this.menu.appendChild(dom)\n this.update()\n\n if (options.floating && !isIOS()) {\n this.updateFloat()\n let potentialScrollers = getAllWrapping(this.wrapper)\n this.scrollFunc = (e) => {\n let root = this.editorView.root\n if (!(root.body || root).contains(this.wrapper)) {\n potentialScrollers.forEach(el => el.removeEventListener(\"scroll\", this.scrollFunc))\n } else {\n this.updateFloat(e.target.getBoundingClientRect && e.target)\n }\n }\n potentialScrollers.forEach(el => el.addEventListener('scroll', this.scrollFunc))\n }\n }\n\n update() {\n this.contentUpdate(this.editorView.state)\n\n if (this.floating) {\n this.updateScrollCursor()\n } else {\n if (this.menu.offsetWidth != this.widthForMaxHeight) {\n this.widthForMaxHeight = this.menu.offsetWidth\n this.maxHeight = 0\n }\n if (this.menu.offsetHeight > this.maxHeight) {\n this.maxHeight = this.menu.offsetHeight\n this.menu.style.minHeight = this.maxHeight + \"px\"\n }\n }\n }\n\n updateScrollCursor() {\n let selection = this.editorView.root.getSelection()\n if (!selection.focusNode) return\n let rects = selection.getRangeAt(0).getClientRects()\n let selRect = rects[selectionIsInverted(selection) ? 0 : rects.length - 1]\n if (!selRect) return\n let menuRect = this.menu.getBoundingClientRect()\n if (selRect.top < menuRect.bottom && selRect.bottom > menuRect.top) {\n let scrollable = findWrappingScrollable(this.wrapper)\n if (scrollable) scrollable.scrollTop -= (menuRect.bottom - selRect.top)\n }\n }\n\n updateFloat(scrollAncestor) {\n let parent = this.wrapper, editorRect = parent.getBoundingClientRect(),\n top = scrollAncestor ? Math.max(0, scrollAncestor.getBoundingClientRect().top) : 0\n\n if (this.floating) {\n if (editorRect.top >= top || editorRect.bottom < this.menu.offsetHeight + 10) {\n this.floating = false\n this.menu.style.position = this.menu.style.left = this.menu.style.top = this.menu.style.width = \"\"\n this.menu.style.display = \"\"\n this.spacer.parentNode.removeChild(this.spacer)\n this.spacer = null\n } else {\n let border = (parent.offsetWidth - parent.clientWidth) / 2\n this.menu.style.left = (editorRect.left + border) + \"px\"\n this.menu.style.display = (editorRect.top > window.innerHeight ? \"none\" : \"\")\n if (scrollAncestor) this.menu.style.top = top + \"px\"\n }\n } else {\n if (editorRect.top < top && editorRect.bottom >= this.menu.offsetHeight + 10) {\n this.floating = true\n let menuRect = this.menu.getBoundingClientRect()\n this.menu.style.left = menuRect.left + \"px\"\n this.menu.style.width = menuRect.width + \"px\"\n if (scrollAncestor) this.menu.style.top = top + \"px\"\n this.menu.style.position = \"fixed\"\n this.spacer = crel(\"div\", {class: prefix + \"-spacer\", style: `height: ${menuRect.height}px`})\n parent.insertBefore(this.spacer, this.menu)\n }\n }\n }\n\n destroy() {\n if (this.wrapper.parentNode)\n this.wrapper.parentNode.replaceChild(this.editorView.dom, this.wrapper)\n }\n}\n\n// Not precise, but close enough\nfunction selectionIsInverted(selection) {\n if (selection.anchorNode == selection.focusNode) return selection.anchorOffset > selection.focusOffset\n return selection.anchorNode.compareDocumentPosition(selection.focusNode) == Node.DOCUMENT_POSITION_FOLLOWING\n}\n\nfunction findWrappingScrollable(node) {\n for (let cur = node.parentNode; cur; cur = cur.parentNode)\n if (cur.scrollHeight > cur.clientHeight) return cur\n}\n\nfunction getAllWrapping(node) {\n let res = [window]\n for (let cur = node.parentNode; cur; cur = cur.parentNode)\n res.push(cur)\n return res\n}\n"],"names":["const","let","prefix","this","update"],"mappings":";;;;;AAAAA,IAAM,GAAG,GAAG,6BAA4B;AACxCA,IAAM,KAAK,GAAG,+BAA8B;;AAE5CA,IAAM,MAAM,GAAG,mBAAkB;;AAEjC,SAAS,QAAQ,CAAC,IAAI,EAAE;EACtBC,IAAI,IAAI,GAAG,EAAC;EACZ,KAAKA,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE;MAClC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,IAAC;EACxD,OAAO,IAA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CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,2BAA2B;CAC7G;;AAED,SAAS,sBAAsB,CAAC,IAAI,EAAE;EACpC,KAAKD,IAAI,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC,UAAU;MACvD,IAAI,GAAG,CAAC,YAAY,GAAG,GAAG,CAAC,YAAY,IAAE,OAAO,OAAG;CACtD;;AAED,SAAS,cAAc,CAAC,IAAI,EAAE;IAC1BA,IAAI,GAAG,GAAG,CAAC,MAAM,EAAC;IAClB,KAAKA,IAAI,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC,UAAU;UACrD,GAAG,CAAC,IAAI,CAAC,GAAG,IAAC;IACjB,OAAO,GAAG;CACb;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
6
|
|
|
7
|
-
var crel = _interopDefault(require('
|
|
7
|
+
var crel = _interopDefault(require('crelt'));
|
|
8
8
|
var prosemirrorCommands = require('prosemirror-commands');
|
|
9
9
|
var prosemirrorHistory = require('prosemirror-history');
|
|
10
10
|
var prosemirrorState = require('prosemirror-state');
|
|
@@ -163,10 +163,6 @@ function translate(view, text) {
|
|
|
163
163
|
// css:: ?string
|
|
164
164
|
// Optionally adds a string of inline CSS to the item's DOM
|
|
165
165
|
// representation.
|
|
166
|
-
//
|
|
167
|
-
// execEvent:: ?string
|
|
168
|
-
// Defines which event on the command's DOM representation should
|
|
169
|
-
// trigger the execution of the command. Defaults to mousedown.
|
|
170
166
|
|
|
171
167
|
var lastMenuEvent = {time: 0, node: null};
|
|
172
168
|
function markMenuEvent(e) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/icons.js","../src/menu.js","../src/menubar.js"],"sourcesContent":["const SVG = \"http://www.w3.org/2000/svg\"\nconst XLINK = \"http://www.w3.org/1999/xlink\"\n\nconst prefix = \"ProseMirror-icon\"\n\nfunction hashPath(path) {\n let hash = 0\n for (let i = 0; i < path.length; i++)\n hash = (((hash << 5) - hash) + path.charCodeAt(i)) | 0\n return hash\n}\n\nexport function getIcon(icon) {\n let node = document.createElement(\"div\")\n node.className = prefix\n if (icon.path) {\n let name = \"pm-icon-\" + hashPath(icon.path).toString(16)\n if (!document.getElementById(name)) buildSVG(name, icon)\n let svg = node.appendChild(document.createElementNS(SVG, \"svg\"))\n svg.style.width = (icon.width / icon.height) + \"em\"\n let use = svg.appendChild(document.createElementNS(SVG, \"use\"))\n use.setAttributeNS(XLINK, \"href\", /([^#]*)/.exec(document.location)[1] + \"#\" + name)\n } else if (icon.dom) {\n node.appendChild(icon.dom.cloneNode(true))\n } else {\n node.appendChild(document.createElement(\"span\")).textContent = icon.text || ''\n if (icon.css) node.firstChild.style.cssText = icon.css\n }\n return node\n}\n\nfunction buildSVG(name, data) {\n let collection = document.getElementById(prefix + \"-collection\")\n if (!collection) {\n collection = document.createElementNS(SVG, \"svg\")\n collection.id = prefix + \"-collection\"\n collection.style.display = \"none\"\n document.body.insertBefore(collection, document.body.firstChild)\n }\n let sym = document.createElementNS(SVG, \"symbol\")\n sym.id = name\n sym.setAttribute(\"viewBox\", \"0 0 \" + data.width + \" \" + data.height)\n let path = sym.appendChild(document.createElementNS(SVG, \"path\"))\n path.setAttribute(\"d\", data.path)\n collection.appendChild(sym)\n}\n","import crel from \"crel\"\nimport {lift, joinUp, selectParentNode, wrapIn, setBlockType} from \"prosemirror-commands\"\nimport {undo, redo} from \"prosemirror-history\"\n\nimport {getIcon} from \"./icons\"\n\nconst prefix = \"ProseMirror-menu\"\n\n// ::- An icon or label that, when clicked, executes a command.\nexport class MenuItem {\n // :: (MenuItemSpec)\n constructor(spec) {\n // :: MenuItemSpec\n // The spec used to create the menu item.\n this.spec = spec\n }\n\n // :: (EditorView) → {dom: dom.Node, update: (EditorState) → bool}\n // Renders the icon according to its [display\n // spec](#menu.MenuItemSpec.display), and adds an event handler which\n // executes the command when the representation is clicked.\n render(view) {\n let spec = this.spec\n let dom = spec.render ? spec.render(view)\n : spec.icon ? getIcon(spec.icon)\n : spec.label ? crel(\"div\", null, translate(view, spec.label))\n : null\n if (!dom) throw new RangeError(\"MenuItem without icon or label property\")\n if (spec.title) {\n const title = (typeof spec.title === \"function\" ? spec.title(view.state) : spec.title)\n dom.setAttribute(\"title\", translate(view, title))\n }\n if (spec.class) dom.classList.add(spec.class)\n if (spec.css) dom.style.cssText += spec.css\n\n dom.addEventListener(\"mousedown\", e => {\n e.preventDefault()\n if (!dom.classList.contains(prefix + \"-disabled\"))\n spec.run(view.state, view.dispatch, view, e)\n })\n\n function update(state) {\n if (spec.select) {\n let selected = spec.select(state)\n dom.style.display = selected ? \"\" : \"none\"\n if (!selected) return false\n }\n let enabled = true\n if (spec.enable) {\n enabled = spec.enable(state) || false\n setClass(dom, prefix + \"-disabled\", !enabled)\n }\n if (spec.active) {\n let active = enabled && spec.active(state) || false\n setClass(dom, prefix + \"-active\", active)\n }\n return true\n }\n\n return {dom, update}\n }\n}\n\nfunction translate(view, text) {\n return view._props.translate ? view._props.translate(text) : text\n}\n\n// MenuItemSpec:: interface\n// The configuration object passed to the `MenuItem` constructor.\n//\n// run:: (EditorState, (Transaction), EditorView, dom.Event)\n// The function to execute when the menu item is activated.\n//\n// select:: ?(EditorState) → bool\n// Optional function that is used to determine whether the item is\n// appropriate at the moment. Deselected items will be hidden.\n//\n// enable:: ?(EditorState) → bool\n// Function that is used to determine if the item is enabled. If\n// given and returning false, the item will be given a disabled\n// styling.\n//\n// active:: ?(EditorState) → bool\n// A predicate function to determine whether the item is 'active' (for\n// example, the item for toggling the strong mark might be active then\n// the cursor is in strong text).\n//\n// render:: ?(EditorView) → dom.Node\n// A function that renders the item. You must provide either this,\n// [`icon`](#menu.MenuItemSpec.icon), or [`label`](#MenuItemSpec.label).\n//\n// icon:: ?Object\n// Describes an icon to show for this item. The object may specify\n// an SVG icon, in which case its `path` property should be an [SVG\n// path\n// spec](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d),\n// and `width` and `height` should provide the viewbox in which that\n// path exists. Alternatively, it may have a `text` property\n// specifying a string of text that makes up the icon, with an\n// optional `css` property giving additional CSS styling for the\n// text. _Or_ it may contain `dom` property containing a DOM node.\n//\n// label:: ?string\n// Makes the item show up as a text label. Mostly useful for items\n// wrapped in a [drop-down](#menu.Dropdown) or similar menu. The object\n// should have a `label` property providing the text to display.\n//\n// title:: ?union<string, (EditorState) → string>\n// Defines DOM title (mouseover) text for the item.\n//\n// class:: ?string\n// Optionally adds a CSS class to the item's DOM representation.\n//\n// css:: ?string\n// Optionally adds a string of inline CSS to the item's DOM\n// representation.\n//\n// execEvent:: ?string\n// Defines which event on the command's DOM representation should\n// trigger the execution of the command. Defaults to mousedown.\n\nlet lastMenuEvent = {time: 0, node: null}\nfunction markMenuEvent(e) {\n lastMenuEvent.time = Date.now()\n lastMenuEvent.node = e.target\n}\nfunction isMenuEvent(wrapper) {\n return Date.now() - 100 < lastMenuEvent.time &&\n lastMenuEvent.node && wrapper.contains(lastMenuEvent.node)\n}\n\n// ::- A drop-down menu, displayed as a label with a downwards-pointing\n// triangle to the right of it.\nexport class Dropdown {\n // :: ([MenuElement], ?Object)\n // Create a dropdown wrapping the elements. Options may include\n // the following properties:\n //\n // **`label`**`: string`\n // : The label to show on the drop-down control.\n //\n // **`title`**`: string`\n // : Sets the\n // [`title`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/title)\n // attribute given to the menu control.\n //\n // **`class`**`: string`\n // : When given, adds an extra CSS class to the menu control.\n //\n // **`css`**`: string`\n // : When given, adds an extra set of CSS styles to the menu control.\n constructor(content, options) {\n this.options = options || {}\n this.content = Array.isArray(content) ? content : [content]\n }\n\n // :: (EditorView) → {dom: dom.Node, update: (EditorState)}\n // Render the dropdown menu and sub-items.\n render(view) {\n let content = renderDropdownItems(this.content, view)\n\n let label = crel(\"div\", {class: prefix + \"-dropdown \" + (this.options.class || \"\"),\n style: this.options.css},\n translate(view, this.options.label))\n if (this.options.title) label.setAttribute(\"title\", translate(view, this.options.title))\n let wrap = crel(\"div\", {class: prefix + \"-dropdown-wrap\"}, label)\n let open = null, listeningOnClose = null\n let close = () => {\n if (open && open.close()) {\n open = null\n window.removeEventListener(\"mousedown\", listeningOnClose)\n }\n }\n label.addEventListener(\"mousedown\", e => {\n e.preventDefault()\n markMenuEvent(e)\n if (open) {\n close()\n } else {\n open = this.expand(wrap, content.dom)\n window.addEventListener(\"mousedown\", listeningOnClose = () => {\n if (!isMenuEvent(wrap)) close()\n })\n }\n })\n\n function update(state) {\n let inner = content.update(state)\n wrap.style.display = inner ? \"\" : \"none\"\n return inner\n }\n\n return {dom: wrap, update}\n }\n\n expand(dom, items) {\n let menuDOM = crel(\"div\", {class: prefix + \"-dropdown-menu \" + (this.options.class || \"\")}, items)\n\n let done = false\n function close() {\n if (done) return\n done = true\n dom.removeChild(menuDOM)\n return true\n }\n dom.appendChild(menuDOM)\n return {close, node: menuDOM}\n }\n}\n\nfunction renderDropdownItems(items, view) {\n let rendered = [], updates = []\n for (let i = 0; i < items.length; i++) {\n let {dom, update} = items[i].render(view)\n rendered.push(crel(\"div\", {class: prefix + \"-dropdown-item\"}, dom))\n updates.push(update)\n }\n return {dom: rendered, update: combineUpdates(updates, rendered)}\n}\n\nfunction combineUpdates(updates, nodes) {\n return state => {\n let something = false\n for (let i = 0; i < updates.length; i++) {\n let up = updates[i](state)\n nodes[i].style.display = up ? \"\" : \"none\"\n if (up) something = true\n }\n return something\n }\n}\n\n// ::- Represents a submenu wrapping a group of elements that start\n// hidden and expand to the right when hovered over or tapped.\nexport class DropdownSubmenu {\n // :: ([MenuElement], ?Object)\n // Creates a submenu for the given group of menu elements. The\n // following options are recognized:\n //\n // **`label`**`: string`\n // : The label to show on the submenu.\n constructor(content, options) {\n this.options = options || {}\n this.content = Array.isArray(content) ? content : [content]\n }\n\n // :: (EditorView) → {dom: dom.Node, update: (EditorState) → bool}\n // Renders the submenu.\n render(view) {\n let items = renderDropdownItems(this.content, view)\n\n let label = crel(\"div\", {class: prefix + \"-submenu-label\"}, translate(view, this.options.label))\n let wrap = crel(\"div\", {class: prefix + \"-submenu-wrap\"}, label,\n crel(\"div\", {class: prefix + \"-submenu\"}, items.dom))\n let listeningOnClose = null\n label.addEventListener(\"mousedown\", e => {\n e.preventDefault()\n markMenuEvent(e)\n setClass(wrap, prefix + \"-submenu-wrap-active\")\n if (!listeningOnClose)\n window.addEventListener(\"mousedown\", listeningOnClose = () => {\n if (!isMenuEvent(wrap)) {\n wrap.classList.remove(prefix + \"-submenu-wrap-active\")\n window.removeEventListener(\"mousedown\", listeningOnClose)\n listeningOnClose = null\n }\n })\n })\n\n function update(state) {\n let inner = items.update(state)\n wrap.style.display = inner ? \"\" : \"none\"\n return inner\n }\n return {dom: wrap, update}\n }\n}\n\n// :: (EditorView, [union<MenuElement, [MenuElement]>]) → {dom: ?dom.DocumentFragment, update: (EditorState) → bool}\n// Render the given, possibly nested, array of menu elements into a\n// document fragment, placing separators between them (and ensuring no\n// superfluous separators appear when some of the groups turn out to\n// be empty).\nexport function renderGrouped(view, content) {\n let result = document.createDocumentFragment()\n let updates = [], separators = []\n for (let i = 0; i < content.length; i++) {\n let items = content[i], localUpdates = [], localNodes = []\n for (let j = 0; j < items.length; j++) {\n let {dom, update} = items[j].render(view)\n let span = crel(\"span\", {class: prefix + \"item\"}, dom)\n result.appendChild(span)\n localNodes.push(span)\n localUpdates.push(update)\n }\n if (localUpdates.length) {\n updates.push(combineUpdates(localUpdates, localNodes))\n if (i < content.length - 1)\n separators.push(result.appendChild(separator()))\n }\n }\n\n function update(state) {\n let something = false, needSep = false\n for (let i = 0; i < updates.length; i++) {\n let hasContent = updates[i](state)\n if (i) separators[i - 1].style.display = needSep && hasContent ? \"\" : \"none\"\n needSep = hasContent\n if (hasContent) something = true\n }\n return something\n }\n return {dom: result, update}\n}\n\nfunction separator() {\n return crel(\"span\", {class: prefix + \"separator\"})\n}\n\n// :: Object\n// A set of basic editor-related icons. Contains the properties\n// `join`, `lift`, `selectParentNode`, `undo`, `redo`, `strong`, `em`,\n// `code`, `link`, `bulletList`, `orderedList`, and `blockquote`, each\n// holding an object that can be used as the `icon` option to\n// `MenuItem`.\nexport const icons = {\n join: {\n width: 800, height: 900,\n path: \"M0 75h800v125h-800z M0 825h800v-125h-800z M250 400h100v-100h100v100h100v100h-100v100h-100v-100h-100z\"\n },\n lift: {\n width: 1024, height: 1024,\n path: \"M219 310v329q0 7-5 12t-12 5q-8 0-13-5l-164-164q-5-5-5-13t5-13l164-164q5-5 13-5 7 0 12 5t5 12zM1024 749v109q0 7-5 12t-12 5h-987q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h987q7 0 12 5t5 12zM1024 530v109q0 7-5 12t-12 5h-621q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h621q7 0 12 5t5 12zM1024 310v109q0 7-5 12t-12 5h-621q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h621q7 0 12 5t5 12zM1024 91v109q0 7-5 12t-12 5h-987q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h987q7 0 12 5t5 12z\"\n },\n selectParentNode: {text: \"\\u2b1a\", css: \"font-weight: bold\"},\n undo: {\n width: 1024, height: 1024,\n path: \"M761 1024c113-206 132-520-313-509v253l-384-384 384-384v248c534-13 594 472 313 775z\"\n },\n redo: {\n width: 1024, height: 1024,\n path: \"M576 248v-248l384 384-384 384v-253c-446-10-427 303-313 509-280-303-221-789 313-775z\"\n },\n strong: {\n width: 805, height: 1024,\n path: \"M317 869q42 18 80 18 214 0 214-191 0-65-23-102-15-25-35-42t-38-26-46-14-48-6-54-1q-41 0-57 5 0 30-0 90t-0 90q0 4-0 38t-0 55 2 47 6 38zM309 442q24 4 62 4 46 0 81-7t62-25 42-51 14-81q0-40-16-70t-45-46-61-24-70-8q-28 0-74 7 0 28 2 86t2 86q0 15-0 45t-0 45q0 26 0 39zM0 950l1-53q8-2 48-9t60-15q4-6 7-15t4-19 3-18 1-21 0-19v-37q0-561-12-585-2-4-12-8t-25-6-28-4-27-2-17-1l-2-47q56-1 194-6t213-5q13 0 39 0t38 0q40 0 78 7t73 24 61 40 42 59 16 78q0 29-9 54t-22 41-36 32-41 25-48 22q88 20 146 76t58 141q0 57-20 102t-53 74-78 48-93 27-100 8q-25 0-75-1t-75-1q-60 0-175 6t-132 6z\"\n },\n em: {\n width: 585, height: 1024,\n path: \"M0 949l9-48q3-1 46-12t63-21q16-20 23-57 0-4 35-165t65-310 29-169v-14q-13-7-31-10t-39-4-33-3l10-58q18 1 68 3t85 4 68 1q27 0 56-1t69-4 56-3q-2 22-10 50-17 5-58 16t-62 19q-4 10-8 24t-5 22-4 26-3 24q-15 84-50 239t-44 203q-1 5-7 33t-11 51-9 47-3 32l0 10q9 2 105 17-1 25-9 56-6 0-18 0t-18 0q-16 0-49-5t-49-5q-78-1-117-1-29 0-81 5t-69 6z\"\n },\n code: {\n width: 896, height: 1024,\n path: \"M608 192l-96 96 224 224-224 224 96 96 288-320-288-320zM288 192l-288 320 288 320 96-96-224-224 224-224-96-96z\"\n },\n link: {\n width: 951, height: 1024,\n path: \"M832 694q0-22-16-38l-118-118q-16-16-38-16-24 0-41 18 1 1 10 10t12 12 8 10 7 14 2 15q0 22-16 38t-38 16q-8 0-15-2t-14-7-10-8-12-12-10-10q-18 17-18 41 0 22 16 38l117 118q15 15 38 15 22 0 38-14l84-83q16-16 16-38zM430 292q0-22-16-38l-117-118q-16-16-38-16-22 0-38 15l-84 83q-16 16-16 38 0 22 16 38l118 118q15 15 38 15 24 0 41-17-1-1-10-10t-12-12-8-10-7-14-2-15q0-22 16-38t38-16q8 0 15 2t14 7 10 8 12 12 10 10q18-17 18-41zM941 694q0 68-48 116l-84 83q-47 47-116 47-69 0-116-48l-117-118q-47-47-47-116 0-70 50-119l-50-50q-49 50-118 50-68 0-116-48l-118-118q-48-48-48-116t48-116l84-83q47-47 116-47 69 0 116 48l117 118q47 47 47 116 0 70-50 119l50 50q49-50 118-50 68 0 116 48l118 118q48 48 48 116z\"\n },\n bulletList: {\n width: 768, height: 896,\n path: \"M0 512h128v-128h-128v128zM0 256h128v-128h-128v128zM0 768h128v-128h-128v128zM256 512h512v-128h-512v128zM256 256h512v-128h-512v128zM256 768h512v-128h-512v128z\"\n },\n orderedList: {\n width: 768, height: 896,\n path: \"M320 512h448v-128h-448v128zM320 768h448v-128h-448v128zM320 128v128h448v-128h-448zM79 384h78v-256h-36l-85 23v50l43-2v185zM189 590c0-36-12-78-96-78-33 0-64 6-83 16l1 66c21-10 42-15 67-15s32 11 32 28c0 26-30 58-110 112v50h192v-67l-91 2c49-30 87-66 87-113l1-1z\"\n },\n blockquote: {\n width: 640, height: 896,\n path: \"M0 448v256h256v-256h-128c0 0 0-128 128-128v-128c0 0-256 0-256 256zM640 320v-128c0 0-256 0-256 256v256h256v-256h-128c0 0 0-128 128-128z\"\n }\n}\n\n// :: MenuItem\n// Menu item for the `joinUp` command.\nexport const joinUpItem = new MenuItem({\n title: \"Join with above block\",\n run: joinUp,\n select: state => joinUp(state),\n icon: icons.join\n})\n\n// :: MenuItem\n// Menu item for the `lift` command.\nexport const liftItem = new MenuItem({\n title: \"Lift out of enclosing block\",\n run: lift,\n select: state => lift(state),\n icon: icons.lift\n})\n\n// :: MenuItem\n// Menu item for the `selectParentNode` command.\nexport const selectParentNodeItem = new MenuItem({\n title: \"Select parent node\",\n run: selectParentNode,\n select: state => selectParentNode(state),\n icon: icons.selectParentNode\n})\n\n// :: MenuItem\n// Menu item for the `undo` command.\nexport let undoItem = new MenuItem({\n title: \"Undo last change\",\n run: undo,\n enable: state => undo(state),\n icon: icons.undo\n})\n\n// :: MenuItem\n// Menu item for the `redo` command.\nexport let redoItem = new MenuItem({\n title: \"Redo last undone change\",\n run: redo,\n enable: state => redo(state),\n icon: icons.redo\n})\n\n// :: (NodeType, Object) → MenuItem\n// Build a menu item for wrapping the selection in a given node type.\n// Adds `run` and `select` properties to the ones present in\n// `options`. `options.attrs` may be an object or a function.\nexport function wrapItem(nodeType, options) {\n let passedOptions = {\n run(state, dispatch) {\n // FIXME if (options.attrs instanceof Function) options.attrs(state, attrs => wrapIn(nodeType, attrs)(state))\n return wrapIn(nodeType, options.attrs)(state, dispatch)\n },\n select(state) {\n return wrapIn(nodeType, options.attrs instanceof Function ? null : options.attrs)(state)\n }\n }\n for (let prop in options) passedOptions[prop] = options[prop]\n return new MenuItem(passedOptions)\n}\n\n// :: (NodeType, Object) → MenuItem\n// Build a menu item for changing the type of the textblock around the\n// selection to the given type. Provides `run`, `active`, and `select`\n// properties. Others must be given in `options`. `options.attrs` may\n// be an object to provide the attributes for the textblock node.\nexport function blockTypeItem(nodeType, options) {\n let command = setBlockType(nodeType, options.attrs)\n let passedOptions = {\n run: command,\n enable(state) { return command(state) },\n active(state) {\n let {$from, to, node} = state.selection\n if (node) return node.hasMarkup(nodeType, options.attrs)\n return to <= $from.end() && $from.parent.hasMarkup(nodeType, options.attrs)\n }\n }\n for (let prop in options) passedOptions[prop] = options[prop]\n return new MenuItem(passedOptions)\n}\n\n// Work around classList.toggle being broken in IE11\nfunction setClass(dom, cls, on) {\n if (on) dom.classList.add(cls)\n else dom.classList.remove(cls)\n}\n","import crel from \"crel\"\nimport {Plugin} from \"prosemirror-state\"\n\nimport {renderGrouped} from \"./menu\"\n\nconst prefix = \"ProseMirror-menubar\"\n\nfunction isIOS() {\n if (typeof navigator == \"undefined\") return false\n let agent = navigator.userAgent\n return !/Edge\\/\\d/.test(agent) && /AppleWebKit/.test(agent) && /Mobile\\/\\w+/.test(agent)\n}\n\n// :: (Object) → Plugin\n// A plugin that will place a menu bar above the editor. Note that\n// this involves wrapping the editor in an additional `<div>`.\n//\n// options::-\n// Supports the following options:\n//\n// content:: [[MenuElement]]\n// Provides the content of the menu, as a nested array to be\n// passed to `renderGrouped`.\n//\n// floating:: ?bool\n// Determines whether the menu floats, i.e. whether it sticks to\n// the top of the viewport when the editor is partially scrolled\n// out of view.\nexport function menuBar(options) {\n return new Plugin({\n view(editorView) { return new MenuBarView(editorView, options) }\n })\n}\n\nclass MenuBarView {\n constructor(editorView, options) {\n this.editorView = editorView\n this.options = options\n\n this.wrapper = crel(\"div\", {class: prefix + \"-wrapper\"})\n this.menu = this.wrapper.appendChild(crel(\"div\", {class: prefix}))\n this.menu.className = prefix\n this.spacer = null\n\n editorView.dom.parentNode.replaceChild(this.wrapper, editorView.dom)\n this.wrapper.appendChild(editorView.dom)\n\n this.maxHeight = 0\n this.widthForMaxHeight = 0\n this.floating = false\n\n let {dom, update} = renderGrouped(this.editorView, this.options.content)\n this.contentUpdate = update\n this.menu.appendChild(dom)\n this.update()\n\n if (options.floating && !isIOS()) {\n this.updateFloat()\n let potentialScrollers = getAllWrapping(this.wrapper)\n this.scrollFunc = (e) => {\n let root = this.editorView.root\n if (!(root.body || root).contains(this.wrapper)) {\n potentialScrollers.forEach(el => el.removeEventListener(\"scroll\", this.scrollFunc))\n } else {\n this.updateFloat(e.target.getBoundingClientRect && e.target)\n }\n }\n potentialScrollers.forEach(el => el.addEventListener('scroll', this.scrollFunc))\n }\n }\n\n update() {\n this.contentUpdate(this.editorView.state)\n\n if (this.floating) {\n this.updateScrollCursor()\n } else {\n if (this.menu.offsetWidth != this.widthForMaxHeight) {\n this.widthForMaxHeight = this.menu.offsetWidth\n this.maxHeight = 0\n }\n if (this.menu.offsetHeight > this.maxHeight) {\n this.maxHeight = this.menu.offsetHeight\n this.menu.style.minHeight = this.maxHeight + \"px\"\n }\n }\n }\n\n updateScrollCursor() {\n let selection = this.editorView.root.getSelection()\n if (!selection.focusNode) return\n let rects = selection.getRangeAt(0).getClientRects()\n let selRect = rects[selectionIsInverted(selection) ? 0 : rects.length - 1]\n if (!selRect) return\n let menuRect = this.menu.getBoundingClientRect()\n if (selRect.top < menuRect.bottom && selRect.bottom > menuRect.top) {\n let scrollable = findWrappingScrollable(this.wrapper)\n if (scrollable) scrollable.scrollTop -= (menuRect.bottom - selRect.top)\n }\n }\n\n updateFloat(scrollAncestor) {\n let parent = this.wrapper, editorRect = parent.getBoundingClientRect(),\n top = scrollAncestor ? Math.max(0, scrollAncestor.getBoundingClientRect().top) : 0\n\n if (this.floating) {\n if (editorRect.top >= top || editorRect.bottom < this.menu.offsetHeight + 10) {\n this.floating = false\n this.menu.style.position = this.menu.style.left = this.menu.style.top = this.menu.style.width = \"\"\n this.menu.style.display = \"\"\n this.spacer.parentNode.removeChild(this.spacer)\n this.spacer = null\n } else {\n let border = (parent.offsetWidth - parent.clientWidth) / 2\n this.menu.style.left = (editorRect.left + border) + \"px\"\n this.menu.style.display = (editorRect.top > window.innerHeight ? \"none\" : \"\")\n if (scrollAncestor) this.menu.style.top = top + \"px\"\n }\n } else {\n if (editorRect.top < top && editorRect.bottom >= this.menu.offsetHeight + 10) {\n this.floating = true\n let menuRect = this.menu.getBoundingClientRect()\n this.menu.style.left = menuRect.left + \"px\"\n this.menu.style.width = menuRect.width + \"px\"\n if (scrollAncestor) this.menu.style.top = top + \"px\"\n this.menu.style.position = \"fixed\"\n this.spacer = crel(\"div\", {class: prefix + \"-spacer\", style: `height: ${menuRect.height}px`})\n parent.insertBefore(this.spacer, this.menu)\n }\n }\n }\n\n destroy() {\n if (this.wrapper.parentNode)\n this.wrapper.parentNode.replaceChild(this.editorView.dom, this.wrapper)\n }\n}\n\n// Not precise, but close enough\nfunction selectionIsInverted(selection) {\n if (selection.anchorNode == selection.focusNode) return selection.anchorOffset > selection.focusOffset\n return selection.anchorNode.compareDocumentPosition(selection.focusNode) == Node.DOCUMENT_POSITION_FOLLOWING\n}\n\nfunction findWrappingScrollable(node) {\n for (let cur = node.parentNode; cur; cur = cur.parentNode)\n if (cur.scrollHeight > cur.clientHeight) return cur\n}\n\nfunction getAllWrapping(node) {\n let res = [window]\n for (let cur = node.parentNode; cur; cur = cur.parentNode)\n res.push(cur)\n return res\n}\n"],"names":["const","let","prefix","this","update","joinUp","lift","selectParentNode","undo","redo","wrapIn","setBlockType","Plugin"],"mappings":";;;;;;;;;;;AAAAA,IAAM,GAAG,GAAG,6BAA4B;AACxCA,IAAM,KAAK,GAAG,+BAA8B;;AAE5CA,IAAM,MAAM,GAAG,mBAAkB;;AAEjC,SAAS,QAAQ,CAAC,IAAI,EAAE;EACtBC,IAAI,IAAI,GAAG,EAAC;EACZ,KAAKA,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE;MAClC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,IAAC;EACxD,OAAO,IAAI;CACZ;;AAED,AAAO,SAAS,OAAO,CAAC,IAAI,EAAE;EAC5BA,IAAI,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,EAAC;EACxC,IAAI,CAAC,SAAS,GAAG,OAAM;EACvB,IAAI,IAAI,CAAC,IAAI,EAAE;IACbA,IAAI,IAAI,GAAG,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAC;IACxD,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,IAAC;IACxDA,IAAI,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,GAAG,EAAE,KAAK,CAAC,EAAC;IAChE,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,IAAI,KAAI;IACnDA,IAAI,GAAG,GAAG,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,eAA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"http://www.w3.org/2000/svg\"\nconst XLINK = \"http://www.w3.org/1999/xlink\"\n\nconst prefix = \"ProseMirror-icon\"\n\nfunction hashPath(path) {\n let hash = 0\n for (let i = 0; i < path.length; i++)\n hash = (((hash << 5) - hash) + path.charCodeAt(i)) | 0\n return hash\n}\n\nexport function getIcon(icon) {\n let node = document.createElement(\"div\")\n node.className = prefix\n if (icon.path) {\n let name = \"pm-icon-\" + hashPath(icon.path).toString(16)\n if (!document.getElementById(name)) buildSVG(name, icon)\n let svg = node.appendChild(document.createElementNS(SVG, \"svg\"))\n svg.style.width = (icon.width / icon.height) + \"em\"\n let use = svg.appendChild(document.createElementNS(SVG, \"use\"))\n use.setAttributeNS(XLINK, \"href\", /([^#]*)/.exec(document.location)[1] + \"#\" + name)\n } else if (icon.dom) {\n node.appendChild(icon.dom.cloneNode(true))\n } else {\n node.appendChild(document.createElement(\"span\")).textContent = icon.text || ''\n if (icon.css) node.firstChild.style.cssText = icon.css\n }\n return node\n}\n\nfunction buildSVG(name, data) {\n let collection = document.getElementById(prefix + \"-collection\")\n if (!collection) {\n collection = document.createElementNS(SVG, \"svg\")\n collection.id = prefix + \"-collection\"\n collection.style.display = \"none\"\n document.body.insertBefore(collection, document.body.firstChild)\n }\n let sym = document.createElementNS(SVG, \"symbol\")\n sym.id = name\n sym.setAttribute(\"viewBox\", \"0 0 \" + data.width + \" \" + data.height)\n let path = sym.appendChild(document.createElementNS(SVG, \"path\"))\n path.setAttribute(\"d\", data.path)\n collection.appendChild(sym)\n}\n","import crel from \"crelt\"\nimport {lift, joinUp, selectParentNode, wrapIn, setBlockType} from \"prosemirror-commands\"\nimport {undo, redo} from \"prosemirror-history\"\n\nimport {getIcon} from \"./icons\"\n\nconst prefix = \"ProseMirror-menu\"\n\n// ::- An icon or label that, when clicked, executes a command.\nexport class MenuItem {\n // :: (MenuItemSpec)\n constructor(spec) {\n // :: MenuItemSpec\n // The spec used to create the menu item.\n this.spec = spec\n }\n\n // :: (EditorView) → {dom: dom.Node, update: (EditorState) → bool}\n // Renders the icon according to its [display\n // spec](#menu.MenuItemSpec.display), and adds an event handler which\n // executes the command when the representation is clicked.\n render(view) {\n let spec = this.spec\n let dom = spec.render ? spec.render(view)\n : spec.icon ? getIcon(spec.icon)\n : spec.label ? crel(\"div\", null, translate(view, spec.label))\n : null\n if (!dom) throw new RangeError(\"MenuItem without icon or label property\")\n if (spec.title) {\n const title = (typeof spec.title === \"function\" ? spec.title(view.state) : spec.title)\n dom.setAttribute(\"title\", translate(view, title))\n }\n if (spec.class) dom.classList.add(spec.class)\n if (spec.css) dom.style.cssText += spec.css\n\n dom.addEventListener(\"mousedown\", e => {\n e.preventDefault()\n if (!dom.classList.contains(prefix + \"-disabled\"))\n spec.run(view.state, view.dispatch, view, e)\n })\n\n function update(state) {\n if (spec.select) {\n let selected = spec.select(state)\n dom.style.display = selected ? \"\" : \"none\"\n if (!selected) return false\n }\n let enabled = true\n if (spec.enable) {\n enabled = spec.enable(state) || false\n setClass(dom, prefix + \"-disabled\", !enabled)\n }\n if (spec.active) {\n let active = enabled && spec.active(state) || false\n setClass(dom, prefix + \"-active\", active)\n }\n return true\n }\n\n return {dom, update}\n }\n}\n\nfunction translate(view, text) {\n return view._props.translate ? view._props.translate(text) : text\n}\n\n// MenuItemSpec:: interface\n// The configuration object passed to the `MenuItem` constructor.\n//\n// run:: (EditorState, (Transaction), EditorView, dom.Event)\n// The function to execute when the menu item is activated.\n//\n// select:: ?(EditorState) → bool\n// Optional function that is used to determine whether the item is\n// appropriate at the moment. Deselected items will be hidden.\n//\n// enable:: ?(EditorState) → bool\n// Function that is used to determine if the item is enabled. If\n// given and returning false, the item will be given a disabled\n// styling.\n//\n// active:: ?(EditorState) → bool\n// A predicate function to determine whether the item is 'active' (for\n// example, the item for toggling the strong mark might be active then\n// the cursor is in strong text).\n//\n// render:: ?(EditorView) → dom.Node\n// A function that renders the item. You must provide either this,\n// [`icon`](#menu.MenuItemSpec.icon), or [`label`](#MenuItemSpec.label).\n//\n// icon:: ?Object\n// Describes an icon to show for this item. The object may specify\n// an SVG icon, in which case its `path` property should be an [SVG\n// path\n// spec](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d),\n// and `width` and `height` should provide the viewbox in which that\n// path exists. Alternatively, it may have a `text` property\n// specifying a string of text that makes up the icon, with an\n// optional `css` property giving additional CSS styling for the\n// text. _Or_ it may contain `dom` property containing a DOM node.\n//\n// label:: ?string\n// Makes the item show up as a text label. Mostly useful for items\n// wrapped in a [drop-down](#menu.Dropdown) or similar menu. The object\n// should have a `label` property providing the text to display.\n//\n// title:: ?union<string, (EditorState) → string>\n// Defines DOM title (mouseover) text for the item.\n//\n// class:: ?string\n// Optionally adds a CSS class to the item's DOM representation.\n//\n// css:: ?string\n// Optionally adds a string of inline CSS to the item's DOM\n// representation.\n\nlet lastMenuEvent = {time: 0, node: null}\nfunction markMenuEvent(e) {\n lastMenuEvent.time = Date.now()\n lastMenuEvent.node = e.target\n}\nfunction isMenuEvent(wrapper) {\n return Date.now() - 100 < lastMenuEvent.time &&\n lastMenuEvent.node && wrapper.contains(lastMenuEvent.node)\n}\n\n// ::- A drop-down menu, displayed as a label with a downwards-pointing\n// triangle to the right of it.\nexport class Dropdown {\n // :: ([MenuElement], ?Object)\n // Create a dropdown wrapping the elements. Options may include\n // the following properties:\n //\n // **`label`**`: string`\n // : The label to show on the drop-down control.\n //\n // **`title`**`: string`\n // : Sets the\n // [`title`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/title)\n // attribute given to the menu control.\n //\n // **`class`**`: string`\n // : When given, adds an extra CSS class to the menu control.\n //\n // **`css`**`: string`\n // : When given, adds an extra set of CSS styles to the menu control.\n constructor(content, options) {\n this.options = options || {}\n this.content = Array.isArray(content) ? content : [content]\n }\n\n // :: (EditorView) → {dom: dom.Node, update: (EditorState)}\n // Render the dropdown menu and sub-items.\n render(view) {\n let content = renderDropdownItems(this.content, view)\n\n let label = crel(\"div\", {class: prefix + \"-dropdown \" + (this.options.class || \"\"),\n style: this.options.css},\n translate(view, this.options.label))\n if (this.options.title) label.setAttribute(\"title\", translate(view, this.options.title))\n let wrap = crel(\"div\", {class: prefix + \"-dropdown-wrap\"}, label)\n let open = null, listeningOnClose = null\n let close = () => {\n if (open && open.close()) {\n open = null\n window.removeEventListener(\"mousedown\", listeningOnClose)\n }\n }\n label.addEventListener(\"mousedown\", e => {\n e.preventDefault()\n markMenuEvent(e)\n if (open) {\n close()\n } else {\n open = this.expand(wrap, content.dom)\n window.addEventListener(\"mousedown\", listeningOnClose = () => {\n if (!isMenuEvent(wrap)) close()\n })\n }\n })\n\n function update(state) {\n let inner = content.update(state)\n wrap.style.display = inner ? \"\" : \"none\"\n return inner\n }\n\n return {dom: wrap, update}\n }\n\n expand(dom, items) {\n let menuDOM = crel(\"div\", {class: prefix + \"-dropdown-menu \" + (this.options.class || \"\")}, items)\n\n let done = false\n function close() {\n if (done) return\n done = true\n dom.removeChild(menuDOM)\n return true\n }\n dom.appendChild(menuDOM)\n return {close, node: menuDOM}\n }\n}\n\nfunction renderDropdownItems(items, view) {\n let rendered = [], updates = []\n for (let i = 0; i < items.length; i++) {\n let {dom, update} = items[i].render(view)\n rendered.push(crel(\"div\", {class: prefix + \"-dropdown-item\"}, dom))\n updates.push(update)\n }\n return {dom: rendered, update: combineUpdates(updates, rendered)}\n}\n\nfunction combineUpdates(updates, nodes) {\n return state => {\n let something = false\n for (let i = 0; i < updates.length; i++) {\n let up = updates[i](state)\n nodes[i].style.display = up ? \"\" : \"none\"\n if (up) something = true\n }\n return something\n }\n}\n\n// ::- Represents a submenu wrapping a group of elements that start\n// hidden and expand to the right when hovered over or tapped.\nexport class DropdownSubmenu {\n // :: ([MenuElement], ?Object)\n // Creates a submenu for the given group of menu elements. The\n // following options are recognized:\n //\n // **`label`**`: string`\n // : The label to show on the submenu.\n constructor(content, options) {\n this.options = options || {}\n this.content = Array.isArray(content) ? content : [content]\n }\n\n // :: (EditorView) → {dom: dom.Node, update: (EditorState) → bool}\n // Renders the submenu.\n render(view) {\n let items = renderDropdownItems(this.content, view)\n\n let label = crel(\"div\", {class: prefix + \"-submenu-label\"}, translate(view, this.options.label))\n let wrap = crel(\"div\", {class: prefix + \"-submenu-wrap\"}, label,\n crel(\"div\", {class: prefix + \"-submenu\"}, items.dom))\n let listeningOnClose = null\n label.addEventListener(\"mousedown\", e => {\n e.preventDefault()\n markMenuEvent(e)\n setClass(wrap, prefix + \"-submenu-wrap-active\")\n if (!listeningOnClose)\n window.addEventListener(\"mousedown\", listeningOnClose = () => {\n if (!isMenuEvent(wrap)) {\n wrap.classList.remove(prefix + \"-submenu-wrap-active\")\n window.removeEventListener(\"mousedown\", listeningOnClose)\n listeningOnClose = null\n }\n })\n })\n\n function update(state) {\n let inner = items.update(state)\n wrap.style.display = inner ? \"\" : \"none\"\n return inner\n }\n return {dom: wrap, update}\n }\n}\n\n// :: (EditorView, [union<MenuElement, [MenuElement]>]) → {dom: ?dom.DocumentFragment, update: (EditorState) → bool}\n// Render the given, possibly nested, array of menu elements into a\n// document fragment, placing separators between them (and ensuring no\n// superfluous separators appear when some of the groups turn out to\n// be empty).\nexport function renderGrouped(view, content) {\n let result = document.createDocumentFragment()\n let updates = [], separators = []\n for (let i = 0; i < content.length; i++) {\n let items = content[i], localUpdates = [], localNodes = []\n for (let j = 0; j < items.length; j++) {\n let {dom, update} = items[j].render(view)\n let span = crel(\"span\", {class: prefix + \"item\"}, dom)\n result.appendChild(span)\n localNodes.push(span)\n localUpdates.push(update)\n }\n if (localUpdates.length) {\n updates.push(combineUpdates(localUpdates, localNodes))\n if (i < content.length - 1)\n separators.push(result.appendChild(separator()))\n }\n }\n\n function update(state) {\n let something = false, needSep = false\n for (let i = 0; i < updates.length; i++) {\n let hasContent = updates[i](state)\n if (i) separators[i - 1].style.display = needSep && hasContent ? \"\" : \"none\"\n needSep = hasContent\n if (hasContent) something = true\n }\n return something\n }\n return {dom: result, update}\n}\n\nfunction separator() {\n return crel(\"span\", {class: prefix + \"separator\"})\n}\n\n// :: Object\n// A set of basic editor-related icons. Contains the properties\n// `join`, `lift`, `selectParentNode`, `undo`, `redo`, `strong`, `em`,\n// `code`, `link`, `bulletList`, `orderedList`, and `blockquote`, each\n// holding an object that can be used as the `icon` option to\n// `MenuItem`.\nexport const icons = {\n join: {\n width: 800, height: 900,\n path: \"M0 75h800v125h-800z M0 825h800v-125h-800z M250 400h100v-100h100v100h100v100h-100v100h-100v-100h-100z\"\n },\n lift: {\n width: 1024, height: 1024,\n path: \"M219 310v329q0 7-5 12t-12 5q-8 0-13-5l-164-164q-5-5-5-13t5-13l164-164q5-5 13-5 7 0 12 5t5 12zM1024 749v109q0 7-5 12t-12 5h-987q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h987q7 0 12 5t5 12zM1024 530v109q0 7-5 12t-12 5h-621q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h621q7 0 12 5t5 12zM1024 310v109q0 7-5 12t-12 5h-621q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h621q7 0 12 5t5 12zM1024 91v109q0 7-5 12t-12 5h-987q-7 0-12-5t-5-12v-109q0-7 5-12t12-5h987q7 0 12 5t5 12z\"\n },\n selectParentNode: {text: \"\\u2b1a\", css: \"font-weight: bold\"},\n undo: {\n width: 1024, height: 1024,\n path: \"M761 1024c113-206 132-520-313-509v253l-384-384 384-384v248c534-13 594 472 313 775z\"\n },\n redo: {\n width: 1024, height: 1024,\n path: \"M576 248v-248l384 384-384 384v-253c-446-10-427 303-313 509-280-303-221-789 313-775z\"\n },\n strong: {\n width: 805, height: 1024,\n path: \"M317 869q42 18 80 18 214 0 214-191 0-65-23-102-15-25-35-42t-38-26-46-14-48-6-54-1q-41 0-57 5 0 30-0 90t-0 90q0 4-0 38t-0 55 2 47 6 38zM309 442q24 4 62 4 46 0 81-7t62-25 42-51 14-81q0-40-16-70t-45-46-61-24-70-8q-28 0-74 7 0 28 2 86t2 86q0 15-0 45t-0 45q0 26 0 39zM0 950l1-53q8-2 48-9t60-15q4-6 7-15t4-19 3-18 1-21 0-19v-37q0-561-12-585-2-4-12-8t-25-6-28-4-27-2-17-1l-2-47q56-1 194-6t213-5q13 0 39 0t38 0q40 0 78 7t73 24 61 40 42 59 16 78q0 29-9 54t-22 41-36 32-41 25-48 22q88 20 146 76t58 141q0 57-20 102t-53 74-78 48-93 27-100 8q-25 0-75-1t-75-1q-60 0-175 6t-132 6z\"\n },\n em: {\n width: 585, height: 1024,\n path: \"M0 949l9-48q3-1 46-12t63-21q16-20 23-57 0-4 35-165t65-310 29-169v-14q-13-7-31-10t-39-4-33-3l10-58q18 1 68 3t85 4 68 1q27 0 56-1t69-4 56-3q-2 22-10 50-17 5-58 16t-62 19q-4 10-8 24t-5 22-4 26-3 24q-15 84-50 239t-44 203q-1 5-7 33t-11 51-9 47-3 32l0 10q9 2 105 17-1 25-9 56-6 0-18 0t-18 0q-16 0-49-5t-49-5q-78-1-117-1-29 0-81 5t-69 6z\"\n },\n code: {\n width: 896, height: 1024,\n path: \"M608 192l-96 96 224 224-224 224 96 96 288-320-288-320zM288 192l-288 320 288 320 96-96-224-224 224-224-96-96z\"\n },\n link: {\n width: 951, height: 1024,\n path: \"M832 694q0-22-16-38l-118-118q-16-16-38-16-24 0-41 18 1 1 10 10t12 12 8 10 7 14 2 15q0 22-16 38t-38 16q-8 0-15-2t-14-7-10-8-12-12-10-10q-18 17-18 41 0 22 16 38l117 118q15 15 38 15 22 0 38-14l84-83q16-16 16-38zM430 292q0-22-16-38l-117-118q-16-16-38-16-22 0-38 15l-84 83q-16 16-16 38 0 22 16 38l118 118q15 15 38 15 24 0 41-17-1-1-10-10t-12-12-8-10-7-14-2-15q0-22 16-38t38-16q8 0 15 2t14 7 10 8 12 12 10 10q18-17 18-41zM941 694q0 68-48 116l-84 83q-47 47-116 47-69 0-116-48l-117-118q-47-47-47-116 0-70 50-119l-50-50q-49 50-118 50-68 0-116-48l-118-118q-48-48-48-116t48-116l84-83q47-47 116-47 69 0 116 48l117 118q47 47 47 116 0 70-50 119l50 50q49-50 118-50 68 0 116 48l118 118q48 48 48 116z\"\n },\n bulletList: {\n width: 768, height: 896,\n path: \"M0 512h128v-128h-128v128zM0 256h128v-128h-128v128zM0 768h128v-128h-128v128zM256 512h512v-128h-512v128zM256 256h512v-128h-512v128zM256 768h512v-128h-512v128z\"\n },\n orderedList: {\n width: 768, height: 896,\n path: \"M320 512h448v-128h-448v128zM320 768h448v-128h-448v128zM320 128v128h448v-128h-448zM79 384h78v-256h-36l-85 23v50l43-2v185zM189 590c0-36-12-78-96-78-33 0-64 6-83 16l1 66c21-10 42-15 67-15s32 11 32 28c0 26-30 58-110 112v50h192v-67l-91 2c49-30 87-66 87-113l1-1z\"\n },\n blockquote: {\n width: 640, height: 896,\n path: \"M0 448v256h256v-256h-128c0 0 0-128 128-128v-128c0 0-256 0-256 256zM640 320v-128c0 0-256 0-256 256v256h256v-256h-128c0 0 0-128 128-128z\"\n }\n}\n\n// :: MenuItem\n// Menu item for the `joinUp` command.\nexport const joinUpItem = new MenuItem({\n title: \"Join with above block\",\n run: joinUp,\n select: state => joinUp(state),\n icon: icons.join\n})\n\n// :: MenuItem\n// Menu item for the `lift` command.\nexport const liftItem = new MenuItem({\n title: \"Lift out of enclosing block\",\n run: lift,\n select: state => lift(state),\n icon: icons.lift\n})\n\n// :: MenuItem\n// Menu item for the `selectParentNode` command.\nexport const selectParentNodeItem = new MenuItem({\n title: \"Select parent node\",\n run: selectParentNode,\n select: state => selectParentNode(state),\n icon: icons.selectParentNode\n})\n\n// :: MenuItem\n// Menu item for the `undo` command.\nexport let undoItem = new MenuItem({\n title: \"Undo last change\",\n run: undo,\n enable: state => undo(state),\n icon: icons.undo\n})\n\n// :: MenuItem\n// Menu item for the `redo` command.\nexport let redoItem = new MenuItem({\n title: \"Redo last undone change\",\n run: redo,\n enable: state => redo(state),\n icon: icons.redo\n})\n\n// :: (NodeType, Object) → MenuItem\n// Build a menu item for wrapping the selection in a given node type.\n// Adds `run` and `select` properties to the ones present in\n// `options`. `options.attrs` may be an object or a function.\nexport function wrapItem(nodeType, options) {\n let passedOptions = {\n run(state, dispatch) {\n // FIXME if (options.attrs instanceof Function) options.attrs(state, attrs => wrapIn(nodeType, attrs)(state))\n return wrapIn(nodeType, options.attrs)(state, dispatch)\n },\n select(state) {\n return wrapIn(nodeType, options.attrs instanceof Function ? null : options.attrs)(state)\n }\n }\n for (let prop in options) passedOptions[prop] = options[prop]\n return new MenuItem(passedOptions)\n}\n\n// :: (NodeType, Object) → MenuItem\n// Build a menu item for changing the type of the textblock around the\n// selection to the given type. Provides `run`, `active`, and `select`\n// properties. Others must be given in `options`. `options.attrs` may\n// be an object to provide the attributes for the textblock node.\nexport function blockTypeItem(nodeType, options) {\n let command = setBlockType(nodeType, options.attrs)\n let passedOptions = {\n run: command,\n enable(state) { return command(state) },\n active(state) {\n let {$from, to, node} = state.selection\n if (node) return node.hasMarkup(nodeType, options.attrs)\n return to <= $from.end() && $from.parent.hasMarkup(nodeType, options.attrs)\n }\n }\n for (let prop in options) passedOptions[prop] = options[prop]\n return new MenuItem(passedOptions)\n}\n\n// Work around classList.toggle being broken in IE11\nfunction setClass(dom, cls, on) {\n if (on) dom.classList.add(cls)\n else dom.classList.remove(cls)\n}\n","import crel from \"crelt\"\nimport {Plugin} from \"prosemirror-state\"\n\nimport {renderGrouped} from \"./menu\"\n\nconst prefix = \"ProseMirror-menubar\"\n\nfunction isIOS() {\n if (typeof navigator == \"undefined\") return false\n let agent = navigator.userAgent\n return !/Edge\\/\\d/.test(agent) && /AppleWebKit/.test(agent) && /Mobile\\/\\w+/.test(agent)\n}\n\n// :: (Object) → Plugin\n// A plugin that will place a menu bar above the editor. Note that\n// this involves wrapping the editor in an additional `<div>`.\n//\n// options::-\n// Supports the following options:\n//\n// content:: [[MenuElement]]\n// Provides the content of the menu, as a nested array to be\n// passed to `renderGrouped`.\n//\n// floating:: ?bool\n// Determines whether the menu floats, i.e. whether it sticks to\n// the top of the viewport when the editor is partially scrolled\n// out of view.\nexport function menuBar(options) {\n return new Plugin({\n view(editorView) { return new MenuBarView(editorView, options) }\n })\n}\n\nclass MenuBarView {\n constructor(editorView, options) {\n this.editorView = editorView\n this.options = options\n\n this.wrapper = crel(\"div\", {class: prefix + \"-wrapper\"})\n this.menu = this.wrapper.appendChild(crel(\"div\", {class: prefix}))\n this.menu.className = prefix\n this.spacer = null\n\n editorView.dom.parentNode.replaceChild(this.wrapper, editorView.dom)\n this.wrapper.appendChild(editorView.dom)\n\n this.maxHeight = 0\n this.widthForMaxHeight = 0\n this.floating = false\n\n let {dom, update} = renderGrouped(this.editorView, this.options.content)\n this.contentUpdate = update\n this.menu.appendChild(dom)\n this.update()\n\n if (options.floating && !isIOS()) {\n this.updateFloat()\n let potentialScrollers = getAllWrapping(this.wrapper)\n this.scrollFunc = (e) => {\n let root = this.editorView.root\n if (!(root.body || root).contains(this.wrapper)) {\n potentialScrollers.forEach(el => el.removeEventListener(\"scroll\", this.scrollFunc))\n } else {\n this.updateFloat(e.target.getBoundingClientRect && e.target)\n }\n }\n potentialScrollers.forEach(el => el.addEventListener('scroll', this.scrollFunc))\n }\n }\n\n update() {\n this.contentUpdate(this.editorView.state)\n\n if (this.floating) {\n this.updateScrollCursor()\n } else {\n if (this.menu.offsetWidth != this.widthForMaxHeight) {\n this.widthForMaxHeight = this.menu.offsetWidth\n this.maxHeight = 0\n }\n if (this.menu.offsetHeight > this.maxHeight) {\n this.maxHeight = this.menu.offsetHeight\n this.menu.style.minHeight = this.maxHeight + \"px\"\n }\n }\n }\n\n updateScrollCursor() {\n let selection = this.editorView.root.getSelection()\n if (!selection.focusNode) return\n let rects = selection.getRangeAt(0).getClientRects()\n let selRect = rects[selectionIsInverted(selection) ? 0 : rects.length - 1]\n if (!selRect) return\n let menuRect = this.menu.getBoundingClientRect()\n if (selRect.top < menuRect.bottom && selRect.bottom > menuRect.top) {\n let scrollable = findWrappingScrollable(this.wrapper)\n if (scrollable) scrollable.scrollTop -= (menuRect.bottom - selRect.top)\n }\n }\n\n updateFloat(scrollAncestor) {\n let parent = this.wrapper, editorRect = parent.getBoundingClientRect(),\n top = scrollAncestor ? Math.max(0, scrollAncestor.getBoundingClientRect().top) : 0\n\n if (this.floating) {\n if (editorRect.top >= top || editorRect.bottom < this.menu.offsetHeight + 10) {\n this.floating = false\n this.menu.style.position = this.menu.style.left = this.menu.style.top = this.menu.style.width = \"\"\n this.menu.style.display = \"\"\n this.spacer.parentNode.removeChild(this.spacer)\n this.spacer = null\n } else {\n let border = (parent.offsetWidth - parent.clientWidth) / 2\n this.menu.style.left = (editorRect.left + border) + \"px\"\n this.menu.style.display = (editorRect.top > window.innerHeight ? \"none\" : \"\")\n if (scrollAncestor) this.menu.style.top = top + \"px\"\n }\n } else {\n if (editorRect.top < top && editorRect.bottom >= this.menu.offsetHeight + 10) {\n this.floating = true\n let menuRect = this.menu.getBoundingClientRect()\n this.menu.style.left = menuRect.left + \"px\"\n this.menu.style.width = menuRect.width + \"px\"\n if (scrollAncestor) this.menu.style.top = top + \"px\"\n this.menu.style.position = \"fixed\"\n this.spacer = crel(\"div\", {class: prefix + \"-spacer\", style: `height: ${menuRect.height}px`})\n parent.insertBefore(this.spacer, this.menu)\n }\n }\n }\n\n destroy() {\n if (this.wrapper.parentNode)\n this.wrapper.parentNode.replaceChild(this.editorView.dom, this.wrapper)\n }\n}\n\n// Not precise, but close enough\nfunction selectionIsInverted(selection) {\n if (selection.anchorNode == selection.focusNode) return selection.anchorOffset > selection.focusOffset\n return selection.anchorNode.compareDocumentPosition(selection.focusNode) == Node.DOCUMENT_POSITION_FOLLOWING\n}\n\nfunction findWrappingScrollable(node) {\n for (let cur = node.parentNode; cur; cur = cur.parentNode)\n if (cur.scrollHeight > cur.clientHeight) return cur\n}\n\nfunction getAllWrapping(node) {\n let res = [window]\n for (let cur = node.parentNode; cur; cur = cur.parentNode)\n res.push(cur)\n return res\n}\n"],"names":["const","let","prefix","this","update","joinUp","lift","selectParentNode","undo","redo","wrapIn","setBlockType","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AAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAC;KAC5C;GACF;EACF;;AAEH,sBAAE,8BAAU;EACR,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU;IAC3B,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,IAAC;CAC1E,CACF;;;AAGD,SAAS,mBAAmB,CAAC,SAAS,EAAE;EACtC,IAAI,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,SAAS,IAAE,OAAO,SAAS,CAAC,YAAY,GAAG,SAAS,CAAC,aAAW;EACtG,OAAO,SAAS,CAAC,UAAU,CAAC,uBAAuB,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,2BAA2B;CAC7G;;AAED,SAAS,sBAAsB,CAAC,IAAI,EAAE;EACpC,KAAKD,IAAI,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC,UAAU;MACvD,IAAI,GAAG,CAAC,YAAY,GAAG,GAAG,CAAC,YAAY,IAAE,OAAO,OAAG;CACtD;;AAED,SAAS,cAAc,CAAC,IAAI,EAAE;IAC1BA,IAAI,GAAG,GAAG,CAAC,MAAM,EAAC;IAClB,KAAKA,IAAI,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC,UAAU;UACrD,GAAG,CAAC,IAAI,CAAC,GAAG,IAAC;IACjB,OAAO,GAAG;CACb;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prosemirror-menu",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Simple menu elements for ProseMirror",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"module": "
|
|
6
|
+
"module": "dist/index.es.js",
|
|
7
7
|
"style": "style/menu.css",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"maintainers": [
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"url": "git://github.com/prosemirror/prosemirror-menu.git"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"
|
|
21
|
+
"crelt": "^1.0.0",
|
|
22
22
|
"prosemirror-state": "^1.0.0",
|
|
23
23
|
"prosemirror-commands": "^1.0.0",
|
|
24
24
|
"prosemirror-history": "^1.0.0"
|
package/rollup.config.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export default {
|
|
1
|
+
module.exports = {
|
|
4
2
|
input: './src/index.js',
|
|
5
|
-
output: {
|
|
6
|
-
|
|
3
|
+
output: [{
|
|
4
|
+
file: 'dist/index.js',
|
|
7
5
|
format: 'cjs',
|
|
8
6
|
sourcemap: true
|
|
9
|
-
},
|
|
10
|
-
|
|
7
|
+
}, {
|
|
8
|
+
file: 'dist/index.es.js',
|
|
9
|
+
format: 'es',
|
|
10
|
+
sourcemap: true
|
|
11
|
+
}],
|
|
12
|
+
plugins: [require('@rollup/plugin-buble')()],
|
|
11
13
|
external(id) { return !/^[\.\/]/.test(id) }
|
|
12
14
|
}
|
package/src/menu.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import crel from "
|
|
1
|
+
import crel from "crelt"
|
|
2
2
|
import {lift, joinUp, selectParentNode, wrapIn, setBlockType} from "prosemirror-commands"
|
|
3
3
|
import {undo, redo} from "prosemirror-history"
|
|
4
4
|
|
|
@@ -114,10 +114,6 @@ function translate(view, text) {
|
|
|
114
114
|
// css:: ?string
|
|
115
115
|
// Optionally adds a string of inline CSS to the item's DOM
|
|
116
116
|
// representation.
|
|
117
|
-
//
|
|
118
|
-
// execEvent:: ?string
|
|
119
|
-
// Defines which event on the command's DOM representation should
|
|
120
|
-
// trigger the execution of the command. Defaults to mousedown.
|
|
121
117
|
|
|
122
118
|
let lastMenuEvent = {time: 0, node: null}
|
|
123
119
|
function markMenuEvent(e) {
|
package/src/menubar.js
CHANGED