@harbour-enterprises/superdoc 0.6.22 → 0.6.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/chunks/{super-editor.es-oCHyvNrc.js → super-editor.es-CrHWJXXN.js} +247 -20
  2. package/dist/chunks/{super-editor.es-oCHyvNrc.js.map → super-editor.es-CrHWJXXN.js.map} +1 -1
  3. package/dist/style.css +24 -0
  4. package/dist/super-editor/chunks/{converter--bwoIbpc.js → converter-aySKZ7KO.js} +3 -3
  5. package/dist/super-editor/chunks/{converter--bwoIbpc.js.map → converter-aySKZ7KO.js.map} +1 -1
  6. package/dist/super-editor/chunks/{docx-zipper-vGmPvnin.js → docx-zipper-DppZRpnB.js} +2 -2
  7. package/dist/super-editor/chunks/{docx-zipper-vGmPvnin.js.map → docx-zipper-DppZRpnB.js.map} +1 -1
  8. package/dist/super-editor/chunks/{editor-CoVn4nwP.js → editor-BOQLUjyE.js} +233 -6
  9. package/dist/super-editor/chunks/editor-BOQLUjyE.js.map +1 -0
  10. package/dist/super-editor/chunks/{toolbar-Bp5Jkft8.js → toolbar-CmhWbPS2.js} +3 -3
  11. package/dist/super-editor/chunks/{toolbar-Bp5Jkft8.js.map → toolbar-CmhWbPS2.js.map} +1 -1
  12. package/dist/super-editor/converter.es.js +1 -1
  13. package/dist/super-editor/core/super-converter/v2/importer/annotationImporter.d.ts +1 -0
  14. package/dist/super-editor/core/super-converter/v2/importer/annotationImporter.d.ts.map +1 -1
  15. package/dist/super-editor/docx-zipper.es.js +2 -2
  16. package/dist/super-editor/editor.es.js +3 -3
  17. package/dist/super-editor/extensions/gapcursor/gapcursor.d.ts +2 -0
  18. package/dist/super-editor/extensions/gapcursor/gapcursor.d.ts.map +1 -0
  19. package/dist/super-editor/extensions/gapcursor/index.d.ts +2 -0
  20. package/dist/super-editor/extensions/gapcursor/index.d.ts.map +1 -0
  21. package/dist/super-editor/extensions/index.d.ts +2 -1
  22. package/dist/super-editor/extensions/index.d.ts.map +1 -1
  23. package/dist/super-editor/file-zipper.es.js +1 -1
  24. package/dist/super-editor/style.css +24 -0
  25. package/dist/super-editor/super-editor.es.js +6 -6
  26. package/dist/super-editor/toolbar.es.js +2 -2
  27. package/dist/super-editor.es.js +1 -1
  28. package/dist/superdoc.es.js +3 -3
  29. package/package.json +1 -1
  30. package/dist/super-editor/chunks/editor-CoVn4nwP.js.map +0 -1
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
12
  var _events, _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _commandService, _css, _Editor_instances, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, endCollaboration_fn, _FieldAnnotationView_instances, createAnnotation_fn;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, f as Schema$1, g as canSplit, l as liftTarget, h as canJoin, j as joinPoint, r as replaceStep$1, R as ReplaceAroundStep, o as objectIncludes, i as ReplaceStep, k as NodeRange, m as findWrapping, n as TrackDeleteMarkName, q as TrackInsertMarkName, v as v4, s as generateDocxRandomId, t as TrackFormatMarkName, u as AddMarkStep, w as RemoveMarkStep, x as comments_module_events, y as twipsToLines, z as pixelsToTwips, B as SuperConverter, E as EditorState, C as toKebabCase, G as kebabCase, H as SelectionRange, I as Transform } from "./converter--bwoIbpc.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, f as Schema$1, g as canSplit, l as liftTarget, h as canJoin, j as joinPoint, r as replaceStep$1, R as ReplaceAroundStep, o as objectIncludes, i as ReplaceStep, k as NodeRange, m as findWrapping, n as TrackDeleteMarkName, q as TrackInsertMarkName, v as v4, s as generateDocxRandomId, t as TrackFormatMarkName, u as AddMarkStep, w as RemoveMarkStep, x as comments_module_events, y as twipsToLines, z as pixelsToTwips, B as SuperConverter, E as EditorState, C as toKebabCase, G as kebabCase, H as SelectionRange, I as Transform } from "./converter-aySKZ7KO.js";
16
16
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, toDisplayString, createApp } from "vue";
17
- import { D as DocxZipper } from "./docx-zipper-vGmPvnin.js";
17
+ import { D as DocxZipper } from "./docx-zipper-DppZRpnB.js";
18
18
  function getMarksFromSelection(state) {
19
19
  const { from: from2, to, empty: empty2 } = state.selection;
20
20
  const marks = [];
@@ -11384,7 +11384,7 @@ const _Editor = class _Editor extends EventEmitter {
11384
11384
  * @returns {Y.Doc | undefined} Updated Y.Doc if any, otherwise undefined
11385
11385
  */
11386
11386
  processCollaborationMigrations() {
11387
- console.debug("[checkVersionMigrations] Current editor version", "0.6.22");
11387
+ console.debug("[checkVersionMigrations] Current editor version", "0.6.24");
11388
11388
  if (!this.options.ydoc) return;
11389
11389
  const metaMap = this.options.ydoc.getMap("meta");
11390
11390
  let docVersion = metaMap.get("version");
@@ -12309,6 +12309,232 @@ const DropCursor = Extension.create({
12309
12309
  return [dropCursor(this.options)];
12310
12310
  }
12311
12311
  });
12312
+ class GapCursor extends Selection {
12313
+ /**
12314
+ Create a gap cursor.
12315
+ */
12316
+ constructor($pos) {
12317
+ super($pos, $pos);
12318
+ }
12319
+ map(doc2, mapping) {
12320
+ let $pos = doc2.resolve(mapping.map(this.head));
12321
+ return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);
12322
+ }
12323
+ content() {
12324
+ return Slice.empty;
12325
+ }
12326
+ eq(other) {
12327
+ return other instanceof GapCursor && other.head == this.head;
12328
+ }
12329
+ toJSON() {
12330
+ return { type: "gapcursor", pos: this.head };
12331
+ }
12332
+ /**
12333
+ @internal
12334
+ */
12335
+ static fromJSON(doc2, json) {
12336
+ if (typeof json.pos != "number")
12337
+ throw new RangeError("Invalid input for GapCursor.fromJSON");
12338
+ return new GapCursor(doc2.resolve(json.pos));
12339
+ }
12340
+ /**
12341
+ @internal
12342
+ */
12343
+ getBookmark() {
12344
+ return new GapBookmark(this.anchor);
12345
+ }
12346
+ /**
12347
+ @internal
12348
+ */
12349
+ static valid($pos) {
12350
+ let parent = $pos.parent;
12351
+ if (parent.isTextblock || !closedBefore($pos) || !closedAfter($pos))
12352
+ return false;
12353
+ let override = parent.type.spec.allowGapCursor;
12354
+ if (override != null)
12355
+ return override;
12356
+ let deflt = parent.contentMatchAt($pos.index()).defaultType;
12357
+ return deflt && deflt.isTextblock;
12358
+ }
12359
+ /**
12360
+ @internal
12361
+ */
12362
+ static findGapCursorFrom($pos, dir, mustMove = false) {
12363
+ search: for (; ; ) {
12364
+ if (!mustMove && GapCursor.valid($pos))
12365
+ return $pos;
12366
+ let pos = $pos.pos, next = null;
12367
+ for (let d = $pos.depth; ; d--) {
12368
+ let parent = $pos.node(d);
12369
+ if (dir > 0 ? $pos.indexAfter(d) < parent.childCount : $pos.index(d) > 0) {
12370
+ next = parent.child(dir > 0 ? $pos.indexAfter(d) : $pos.index(d) - 1);
12371
+ break;
12372
+ } else if (d == 0) {
12373
+ return null;
12374
+ }
12375
+ pos += dir;
12376
+ let $cur = $pos.doc.resolve(pos);
12377
+ if (GapCursor.valid($cur))
12378
+ return $cur;
12379
+ }
12380
+ for (; ; ) {
12381
+ let inside = dir > 0 ? next.firstChild : next.lastChild;
12382
+ if (!inside) {
12383
+ if (next.isAtom && !next.isText && !NodeSelection.isSelectable(next)) {
12384
+ $pos = $pos.doc.resolve(pos + next.nodeSize * dir);
12385
+ mustMove = false;
12386
+ continue search;
12387
+ }
12388
+ break;
12389
+ }
12390
+ next = inside;
12391
+ pos += dir;
12392
+ let $cur = $pos.doc.resolve(pos);
12393
+ if (GapCursor.valid($cur))
12394
+ return $cur;
12395
+ }
12396
+ return null;
12397
+ }
12398
+ }
12399
+ }
12400
+ GapCursor.prototype.visible = false;
12401
+ GapCursor.findFrom = GapCursor.findGapCursorFrom;
12402
+ Selection.jsonID("gapcursor", GapCursor);
12403
+ class GapBookmark {
12404
+ constructor(pos) {
12405
+ this.pos = pos;
12406
+ }
12407
+ map(mapping) {
12408
+ return new GapBookmark(mapping.map(this.pos));
12409
+ }
12410
+ resolve(doc2) {
12411
+ let $pos = doc2.resolve(this.pos);
12412
+ return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);
12413
+ }
12414
+ }
12415
+ function closedBefore($pos) {
12416
+ for (let d = $pos.depth; d >= 0; d--) {
12417
+ let index2 = $pos.index(d), parent = $pos.node(d);
12418
+ if (index2 == 0) {
12419
+ if (parent.type.spec.isolating)
12420
+ return true;
12421
+ continue;
12422
+ }
12423
+ for (let before = parent.child(index2 - 1); ; before = before.lastChild) {
12424
+ if (before.childCount == 0 && !before.inlineContent || before.isAtom || before.type.spec.isolating)
12425
+ return true;
12426
+ if (before.inlineContent)
12427
+ return false;
12428
+ }
12429
+ }
12430
+ return true;
12431
+ }
12432
+ function closedAfter($pos) {
12433
+ for (let d = $pos.depth; d >= 0; d--) {
12434
+ let index2 = $pos.indexAfter(d), parent = $pos.node(d);
12435
+ if (index2 == parent.childCount) {
12436
+ if (parent.type.spec.isolating)
12437
+ return true;
12438
+ continue;
12439
+ }
12440
+ for (let after = parent.child(index2); ; after = after.firstChild) {
12441
+ if (after.childCount == 0 && !after.inlineContent || after.isAtom || after.type.spec.isolating)
12442
+ return true;
12443
+ if (after.inlineContent)
12444
+ return false;
12445
+ }
12446
+ }
12447
+ return true;
12448
+ }
12449
+ function gapCursor() {
12450
+ return new Plugin({
12451
+ props: {
12452
+ decorations: drawGapCursor,
12453
+ createSelectionBetween(_view, $anchor, $head) {
12454
+ return $anchor.pos == $head.pos && GapCursor.valid($head) ? new GapCursor($head) : null;
12455
+ },
12456
+ handleClick,
12457
+ handleKeyDown: handleKeyDown$1,
12458
+ handleDOMEvents: { beforeinput }
12459
+ }
12460
+ });
12461
+ }
12462
+ const handleKeyDown$1 = keydownHandler({
12463
+ "ArrowLeft": arrow$3("horiz", -1),
12464
+ "ArrowRight": arrow$3("horiz", 1),
12465
+ "ArrowUp": arrow$3("vert", -1),
12466
+ "ArrowDown": arrow$3("vert", 1)
12467
+ });
12468
+ function arrow$3(axis, dir) {
12469
+ const dirStr = axis == "vert" ? dir > 0 ? "down" : "up" : dir > 0 ? "right" : "left";
12470
+ return function(state, dispatch, view) {
12471
+ let sel = state.selection;
12472
+ let $start = dir > 0 ? sel.$to : sel.$from, mustMove = sel.empty;
12473
+ if (sel instanceof TextSelection) {
12474
+ if (!view.endOfTextblock(dirStr) || $start.depth == 0)
12475
+ return false;
12476
+ mustMove = false;
12477
+ $start = state.doc.resolve(dir > 0 ? $start.after() : $start.before());
12478
+ }
12479
+ let $found = GapCursor.findGapCursorFrom($start, dir, mustMove);
12480
+ if (!$found)
12481
+ return false;
12482
+ if (dispatch)
12483
+ dispatch(state.tr.setSelection(new GapCursor($found)));
12484
+ return true;
12485
+ };
12486
+ }
12487
+ function handleClick(view, pos, event) {
12488
+ if (!view || !view.editable)
12489
+ return false;
12490
+ let $pos = view.state.doc.resolve(pos);
12491
+ if (!GapCursor.valid($pos))
12492
+ return false;
12493
+ let clickPos = view.posAtCoords({ left: event.clientX, top: event.clientY });
12494
+ if (clickPos && clickPos.inside > -1 && NodeSelection.isSelectable(view.state.doc.nodeAt(clickPos.inside)))
12495
+ return false;
12496
+ view.dispatch(view.state.tr.setSelection(new GapCursor($pos)));
12497
+ return true;
12498
+ }
12499
+ function beforeinput(view, event) {
12500
+ if (event.inputType != "insertCompositionText" || !(view.state.selection instanceof GapCursor))
12501
+ return false;
12502
+ let { $from } = view.state.selection;
12503
+ let insert = $from.parent.contentMatchAt($from.index()).findWrapping(view.state.schema.nodes.text);
12504
+ if (!insert)
12505
+ return false;
12506
+ let frag = Fragment.empty;
12507
+ for (let i = insert.length - 1; i >= 0; i--)
12508
+ frag = Fragment.from(insert[i].createAndFill(null, frag));
12509
+ let tr = view.state.tr.replace($from.pos, $from.pos, new Slice(frag, 0, 0));
12510
+ tr.setSelection(TextSelection.near(tr.doc.resolve($from.pos + 1)));
12511
+ view.dispatch(tr);
12512
+ return false;
12513
+ }
12514
+ function drawGapCursor(state) {
12515
+ if (!(state.selection instanceof GapCursor))
12516
+ return null;
12517
+ let node = document.createElement("div");
12518
+ node.className = "ProseMirror-gapcursor";
12519
+ return DecorationSet.create(state.doc, [Decoration.widget(state.selection.head, node, { key: "gapcursor" })]);
12520
+ }
12521
+ const Gapcursor = Extension.create({
12522
+ name: "gapCursor",
12523
+ addPmPlugins() {
12524
+ return [
12525
+ gapCursor()
12526
+ ];
12527
+ },
12528
+ extendNodeSchema(extension) {
12529
+ return {
12530
+ allowGapCursor: callOrGet(getExtensionConfigField(extension, "allowGapCursor", {
12531
+ name: extension.name,
12532
+ options: extension.options,
12533
+ storage: extension.storage
12534
+ })) ?? null
12535
+ };
12536
+ }
12537
+ });
12312
12538
  const CollaborationPluginKey = new PluginKey("collaboration");
12313
12539
  const Collaboration = Extension.create({
12314
12540
  name: "collaboration",
@@ -21320,7 +21546,7 @@ const _sfc_main = {
21320
21546
  });
21321
21547
  return filtered;
21322
21548
  });
21323
- const handleClick = (user) => {
21549
+ const handleClick2 = (user) => {
21324
21550
  props.inserMention(user);
21325
21551
  };
21326
21552
  const handleKeydown = (event) => {
@@ -21355,7 +21581,7 @@ const _sfc_main = {
21355
21581
  }, [
21356
21582
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(getFilteredUsers.value, (user, index2) => {
21357
21583
  return openBlock(), createElementBlock("div", {
21358
- onClick: withModifiers(($event) => handleClick(user), ["stop", "prevent"]),
21584
+ onClick: withModifiers(($event) => handleClick2(user), ["stop", "prevent"]),
21359
21585
  onMouseenter: ($event) => activeUserIndex.value = index2,
21360
21586
  onMouseleave: _cache[0] || (_cache[0] = ($event) => activeUserIndex.value = null),
21361
21587
  key: user.email,
@@ -21885,6 +22111,7 @@ const getStarterExtensions = () => {
21885
22111
  Underline,
21886
22112
  FormatCommands,
21887
22113
  CommentsPlugin,
22114
+ Gapcursor,
21888
22115
  Table,
21889
22116
  TableRow,
21890
22117
  TableCell,
@@ -21926,4 +22153,4 @@ export {
21926
22153
  redoDepth as r,
21927
22154
  undoDepth as u
21928
22155
  };
21929
- //# sourceMappingURL=editor-CoVn4nwP.js.map
22156
+ //# sourceMappingURL=editor-BOQLUjyE.js.map