@pixerate/editor 0.26.0 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,7 @@ var _chunkMKA3AHLVcjs = require('./chunk-MKA3AHLV.cjs');
23
23
 
24
24
 
25
25
 
26
- var _chunkRRREAOVMcjs = require('./chunk-RRREAOVM.cjs');
26
+ var _chunkHNDSPZ5Tcjs = require('./chunk-HNDSPZ5T.cjs');
27
27
 
28
28
 
29
29
 
@@ -38,7 +38,7 @@ var _chunkHDYMLS3Xcjs = require('./chunk-HDYMLS3X.cjs');
38
38
 
39
39
 
40
40
 
41
- var _chunkNFVBT3UZcjs = require('./chunk-NFVBT3UZ.cjs');
41
+ var _chunk66IMF6ODcjs = require('./chunk-66IMF6OD.cjs');
42
42
 
43
43
 
44
44
 
@@ -2869,7 +2869,7 @@ var FORMAT_MARK_TYPES = [
2869
2869
  var formatMarks = (f) => FORMAT_MARK_TYPES.filter(([key]) => f[key]).map(([, type]) => ({ type }));
2870
2870
  var formatKey = (f) => `${f.b ? 1 : 0}${f.i ? 1 : 0}${f.u ? 1 : 0}${f.s ? 1 : 0}${f.sup ? 1 : 0}${f.sub ? 1 : 0}|${_nullishCoalesce(f.href, () => ( ""))}` + (f.rev ? `|${f.rev.kind}:${f.rev.changeId}:${_nullishCoalesce(f.rev.moveId, () => ( ""))}` : "") + (f.fmt ? `|f:${f.fmt.changeId}` : "") + (f.comments ? `|c:${f.comments.join(",")}` : "");
2871
2871
  function changeAttrs(change) {
2872
- return ` data-change-id="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, change.changeId)}" data-author-id="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, change.authorId)}" data-author-name="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, change.authorName)}" data-created-at="${change.createdAt}"`;
2872
+ return ` data-change-id="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, change.changeId)}" data-author-id="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, change.authorId)}" data-author-name="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, change.authorName)}" data-created-at="${change.createdAt}"`;
2873
2873
  }
2874
2874
  function wrapFormat(inner, f) {
2875
2875
  let html = inner;
@@ -2880,15 +2880,15 @@ function wrapFormat(inner, f) {
2880
2880
  if (f.i) html = `<em>${html}</em>`;
2881
2881
  if (f.b) html = `<strong>${html}</strong>`;
2882
2882
  if (f.fmt) {
2883
- html = `<span data-change-type="format"${changeAttrs(f.fmt)} data-format-before="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, JSON.stringify(f.fmt.before))}" data-format-after="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, JSON.stringify(f.fmt.after))}">${html}</span>`;
2883
+ html = `<span data-change-type="format"${changeAttrs(f.fmt)} data-format-before="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, JSON.stringify(f.fmt.before))}" data-format-after="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, JSON.stringify(f.fmt.after))}">${html}</span>`;
2884
2884
  }
2885
2885
  if (f.rev) {
2886
2886
  const tag = f.rev.kind === "insertion" ? "ins" : "del";
2887
- const move = f.rev.moveId ? ` data-move-id="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, f.rev.moveId)}"` : "";
2887
+ const move = f.rev.moveId ? ` data-move-id="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, f.rev.moveId)}"` : "";
2888
2888
  html = `<${tag} data-change-type="${f.rev.kind}"${changeAttrs(f.rev)}${move}>${html}</${tag}>`;
2889
2889
  }
2890
- for (const id of [..._nullishCoalesce(f.comments, () => ( []))].reverse()) html = `<span data-comment-id="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, id)}">${html}</span>`;
2891
- if (f.href) html = `<a href="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, f.href)}">${html}</a>`;
2890
+ for (const id of [..._nullishCoalesce(f.comments, () => ( []))].reverse()) html = `<span data-comment-id="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, id)}">${html}</span>`;
2891
+ if (f.href) html = `<a href="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, f.href)}">${html}</a>`;
2892
2892
  return html;
2893
2893
  }
2894
2894
  function renderSegments(segments, code = false) {
@@ -2900,9 +2900,9 @@ function renderSegments(segments, code = false) {
2900
2900
  let j = i;
2901
2901
  for (; j < segments.length && formatKey(segments[j].format) === key; j++) {
2902
2902
  const seg = segments[j];
2903
- if (seg.kind === "text") inner += _chunkNFVBT3UZcjs.escapeHtml.call(void 0, seg.text);
2903
+ if (seg.kind === "text") inner += _chunk66IMF6ODcjs.escapeHtml.call(void 0, seg.text);
2904
2904
  else if (seg.kind === "br") inner += code ? "\n" : "<br>";
2905
- else if (seg.kind === "img") inner += code ? "" : `<img src="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, seg.src)}" alt="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, seg.alt)}">`;
2905
+ else if (seg.kind === "img") inner += code ? "" : `<img src="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, seg.src)}" alt="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, seg.alt)}">`;
2906
2906
  else inner += `<sup>${seg.n}</sup>`;
2907
2907
  }
2908
2908
  const format = segments[i].format;
@@ -3239,7 +3239,7 @@ function blockChangeAttr(pPr, ctx) {
3239
3239
  createdAt: dateOf(attr(change, "date")),
3240
3240
  previous
3241
3241
  };
3242
- return ` data-block-change="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, JSON.stringify(record))}"`;
3242
+ return ` data-block-change="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, JSON.stringify(record))}"`;
3243
3243
  }
3244
3244
  function renderBlocks(container, ctx, part, topLevel = false) {
3245
3245
  let html = "";
@@ -3281,7 +3281,7 @@ function renderBlocks(container, ctx, part, topLevel = false) {
3281
3281
  const task = list && !list.ordered ? renderer.takeTaskGlyph() : void 0;
3282
3282
  const inner = renderer.html();
3283
3283
  const mappedStyle = styleId ? ctx.styleIds.get(styleId) : void 0;
3284
- const styleAttr = !heading && !list && mappedStyle && mappedStyle !== _chunk3CC7OPUQcjs.NORMAL_STYLE_ID ? ` data-style="${_chunkNFVBT3UZcjs.escapeHtml.call(void 0, mappedStyle)}"` : "";
3284
+ const styleAttr = !heading && !list && mappedStyle && mappedStyle !== _chunk3CC7OPUQcjs.NORMAL_STYLE_ID ? ` data-style="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, mappedStyle)}"` : "";
3285
3285
  const changeAttr = topLevel && !list && ctx.tracked === "marks" ? blockChangeAttr(pPr, ctx) : "";
3286
3286
  const blockHtml = heading ? `<h${heading}${changeAttr}>${inner}</h${heading}>` : `<p${styleAttr}${changeAttr}>${inner}</p>`;
3287
3287
  if (!list) {
@@ -3455,8 +3455,8 @@ async function docxToDocumentImport(data, options = {}) {
3455
3455
  }
3456
3456
  html += `<hr><ol>${notesHtml}</ol>`;
3457
3457
  }
3458
- const sanitized = _chunkRRREAOVMcjs.sanitizeImportedHtml.call(void 0, html);
3459
- const result = { html: sanitized, text: _chunkNFVBT3UZcjs.htmlToPlainText.call(void 0, sanitized) };
3458
+ const sanitized = _chunkHNDSPZ5Tcjs.sanitizeImportedHtml.call(void 0, html);
3459
+ const result = { html: sanitized, text: _chunk66IMF6ODcjs.htmlToPlainText.call(void 0, sanitized) };
3460
3460
  if (threads.length) result.comments = { version: 1, threads };
3461
3461
  if (useStyles) {
3462
3462
  const definitions = styleDefinitions(styles, styleIds);
@@ -3487,7 +3487,7 @@ var markdownImportAdapter = {
3487
3487
  target: "document",
3488
3488
  async import(_input, context) {
3489
3489
  const text = await context.readText();
3490
- return { html: _chunkNFVBT3UZcjs.markdownToTipTapHtml.call(void 0, text), text };
3490
+ return { html: _chunk66IMF6ODcjs.markdownToTipTapHtml.call(void 0, text), text };
3491
3491
  }
3492
3492
  };
3493
3493
  var htmlImportAdapter = {
@@ -3497,8 +3497,8 @@ var htmlImportAdapter = {
3497
3497
  extensions: [".html", ".htm", ".xhtml"],
3498
3498
  target: "document",
3499
3499
  async import(_input, context) {
3500
- const html = _chunkRRREAOVMcjs.sanitizeImportedHtml.call(void 0, await context.readText());
3501
- return { html, text: _chunkNFVBT3UZcjs.htmlToPlainText.call(void 0, html) };
3500
+ const html = _chunkHNDSPZ5Tcjs.sanitizeImportedHtml.call(void 0, await context.readText());
3501
+ return { html, text: _chunk66IMF6ODcjs.htmlToPlainText.call(void 0, html) };
3502
3502
  }
3503
3503
  };
3504
3504
  var plainTextImportAdapter = {
@@ -3509,7 +3509,7 @@ var plainTextImportAdapter = {
3509
3509
  target: "document",
3510
3510
  async import(_input, context) {
3511
3511
  const text = (await context.readText()).replace(/\r\n?/g, "\n");
3512
- return { html: _chunkRRREAOVMcjs.plainTextToParagraphHtml.call(void 0, text), text };
3512
+ return { html: _chunkHNDSPZ5Tcjs.plainTextToParagraphHtml.call(void 0, text), text };
3513
3513
  }
3514
3514
  };
3515
3515
  var rtfImportAdapter = {
@@ -3519,8 +3519,8 @@ var rtfImportAdapter = {
3519
3519
  extensions: [".rtf"],
3520
3520
  target: "document",
3521
3521
  async import(_input, context) {
3522
- const text = _chunkRRREAOVMcjs.rtfToPlainText.call(void 0, await context.readText());
3523
- return { html: _chunkRRREAOVMcjs.plainTextToParagraphHtml.call(void 0, text), text };
3522
+ const text = _chunkHNDSPZ5Tcjs.rtfToPlainText.call(void 0, await context.readText());
3523
+ return { html: _chunkHNDSPZ5Tcjs.plainTextToParagraphHtml.call(void 0, text), text };
3524
3524
  }
3525
3525
  };
3526
3526
  var BUILT_IN_IMPORT_ADAPTERS = [
@@ -3574,7 +3574,7 @@ function insertImportedDocument(target, content, options = {}) {
3574
3574
  if (!htmlSlice && from === to && !state.doc.resolve(from).parent.inlineContent) {
3575
3575
  from = to = _state.Selection.near(state.doc.resolve(from)).from;
3576
3576
  }
3577
- const tr = htmlSlice ? state.tr.replaceRange(from, to, htmlSlice) : state.tr.replace(from, to, _chunkNFVBT3UZcjs.plainTextToSlice.call(void 0, content.text, state.schema));
3577
+ const tr = htmlSlice ? state.tr.replaceRange(from, to, htmlSlice) : state.tr.replace(from, to, _chunk66IMF6ODcjs.plainTextToSlice.call(void 0, content.text, state.schema));
3578
3578
  const end = tr.mapping.map(to, 1);
3579
3579
  view.dispatch(tr.scrollIntoView().setMeta("uiEvent", "drop"));
3580
3580
  return end;
@@ -3703,7 +3703,7 @@ var richClipboardPluginKey = new (0, _state.PluginKey)("richClipboard");
3703
3703
  function writeRichClipboard(view, event, options = {}) {
3704
3704
  const { state } = view;
3705
3705
  if (state.selection.empty) return false;
3706
- const data = _chunkRRREAOVMcjs.getClipboardData.call(void 0, event);
3706
+ const data = _chunkHNDSPZ5Tcjs.getClipboardData.call(void 0, event);
3707
3707
  if (!data || typeof data.setData !== "function") return false;
3708
3708
  const slice = state.selection.content();
3709
3709
  const { dom, text } = view.serializeForClipboard(slice);
@@ -3711,7 +3711,7 @@ function writeRichClipboard(view, event, options = {}) {
3711
3711
  _optionalChain([data, 'access', _146 => _146.clearData, 'optionalCall', _147 => _147()]);
3712
3712
  data.setData("text/html", dom.innerHTML);
3713
3713
  data.setData("text/plain", text);
3714
- data.setData(_nullishCoalesce(options.mimeType, () => ( _chunkRRREAOVMcjs.PIXERATE_DOCUMENT_MIME)), _chunkRRREAOVMcjs.serializeRichClipboardPayload.call(void 0, slice, state.schema));
3714
+ data.setData(_nullishCoalesce(options.mimeType, () => ( _chunkHNDSPZ5Tcjs.PIXERATE_DOCUMENT_MIME)), _chunkHNDSPZ5Tcjs.serializeRichClipboardPayload.call(void 0, slice, state.schema));
3715
3715
  if (options.cut && view.editable) {
3716
3716
  view.dispatch(state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
3717
3717
  }
@@ -3721,7 +3721,7 @@ var RichClipboard = _core.Extension.create({
3721
3721
  name: "richClipboard",
3722
3722
  addOptions() {
3723
3723
  return {
3724
- mimeType: _chunkRRREAOVMcjs.PIXERATE_DOCUMENT_MIME,
3724
+ mimeType: _chunkHNDSPZ5Tcjs.PIXERATE_DOCUMENT_MIME,
3725
3725
  plainTextMode: false
3726
3726
  };
3727
3727
  },
@@ -3729,7 +3729,7 @@ var RichClipboard = _core.Extension.create({
3729
3729
  return { plainTextMode: !!this.options.plainTextMode };
3730
3730
  },
3731
3731
  addProseMirrorPlugins() {
3732
- const mimeType = _nullishCoalesce(this.options.mimeType, () => ( _chunkRRREAOVMcjs.PIXERATE_DOCUMENT_MIME));
3732
+ const mimeType = _nullishCoalesce(this.options.mimeType, () => ( _chunkHNDSPZ5Tcjs.PIXERATE_DOCUMENT_MIME));
3733
3733
  const storage = this.storage;
3734
3734
  return [
3735
3735
  new (0, _state.Plugin)({
@@ -3741,7 +3741,7 @@ var RichClipboard = _core.Extension.create({
3741
3741
  },
3742
3742
  handlePaste(view, event) {
3743
3743
  if (storage.plainTextMode) return false;
3744
- const slice = _chunkRRREAOVMcjs.readRichClipboard.call(void 0, event, view.state.schema, mimeType);
3744
+ const slice = _chunkHNDSPZ5Tcjs.readRichClipboard.call(void 0, event, view.state.schema, mimeType);
3745
3745
  if (!slice) return false;
3746
3746
  event.preventDefault();
3747
3747
  view.dispatch(
@@ -7637,4 +7637,4 @@ function createTableCommands(editor, options = {}) {
7637
7637
 
7638
7638
 
7639
7639
  exports.GradientText = GradientText; exports.SlashCommands = SlashCommands; exports.TemplateSuggestions = TemplateSuggestions; exports.LoadingNode = LoadingNode; exports.SMILIE_REPLACEMENTS = SMILIE_REPLACEMENTS; exports.smilieAutocorrectRules = smilieAutocorrectRules; exports.SmilieReplacer = SmilieReplacer; exports.findHexColors = findHexColors; exports.ColorHighlighter = ColorHighlighter; exports.FontSize = FontSize; exports.Mention = Mention; exports.getMentionNodes = getMentionNodes; exports.setMentionRoleAt = setMentionRoleAt; exports.createMentionExtension = createMentionExtension; exports.Markdown = Markdown2; exports.imagePastePluginKey = imagePastePluginKey; exports.insertImageNode = insertImageNode; exports.updateImageSrc = updateImageSrc; exports.removeImageNode = removeImageNode; exports.handleImageInsertion = handleImageInsertion; exports.Image = Image2; exports.commentsPluginKey = commentsPluginKey; exports.COMMENT_MARK_NAME = COMMENT_MARK_NAME; exports.findCommentRanges = findCommentRanges; exports.getCommentAnchors = getCommentAnchors; exports.getCommentIdsAt = getCommentIdsAt; exports.getCommentStore = getCommentStore; exports.Comments = Comments; exports.getCommentAuthor = getCommentAuthor; exports.compareInEditor = compareInEditor; exports.applyDocumentComparison = applyDocumentComparison; exports.DocumentCompare = DocumentCompare; exports.ImportError = ImportError; exports.createImportContext = createImportContext; exports.ImportAdapterRegistry = ImportAdapterRegistry; exports.DOCX_MIME_TYPES = DOCX_MIME_TYPES; exports.DEFAULT_DOCX_MAX_IMAGE_SIZE = DEFAULT_DOCX_MAX_IMAGE_SIZE; exports.docxToDocumentImport = docxToDocumentImport; exports.createDocxImportAdapter = createDocxImportAdapter; exports.docxImportAdapter = docxImportAdapter; exports.markdownImportAdapter = markdownImportAdapter; exports.htmlImportAdapter = htmlImportAdapter; exports.plainTextImportAdapter = plainTextImportAdapter; exports.rtfImportAdapter = rtfImportAdapter; exports.BUILT_IN_IMPORT_ADAPTERS = BUILT_IN_IMPORT_ADAPTERS; exports.createImportAdapterRegistry = createImportAdapterRegistry; exports.defaultImportRegistry = defaultImportRegistry; exports.registerImportAdapter = registerImportAdapter; exports.unregisterImportAdapter = unregisterImportAdapter; exports.findImportAdapter = findImportAdapter; exports.importFile = importFile; exports.getImportAccept = getImportAccept; exports.htmlToSlice = htmlToSlice; exports.insertImportedDocument = insertImportedDocument; exports.applyImportedReviewData = applyImportedReviewData; exports.importFilesIntoEditor = importFilesIntoEditor; exports.fileImportPluginKey = fileImportPluginKey; exports.FileImport = FileImport; exports.richClipboardPluginKey = richClipboardPluginKey; exports.writeRichClipboard = writeRichClipboard; exports.RichClipboard = RichClipboard; exports.smartQuoteRules = smartQuoteRules; exports.symbolRules = symbolRules; exports.fractionRules = fractionRules; exports.capitalizeSentenceRules = capitalizeSentenceRules; exports.twoInitialCapitalsRules = twoInitialCapitalsRules; exports.defaultAutocorrectRules = defaultAutocorrectRules; exports.DEFAULT_AUTOCORRECT_EXCEPTIONS = DEFAULT_AUTOCORRECT_EXCEPTIONS; exports.autocorrectPluginKey = autocorrectPluginKey; exports.findAutocorrection = findAutocorrection; exports.isInsidePromptToken = isInsidePromptToken; exports.Autocorrect = Autocorrect; exports.outlinePluginKey = outlinePluginKey; exports.computeOutline = computeOutline; exports.buildOutlineTree = buildOutlineTree; exports.getOutline = getOutline; exports.getActiveHeading = getActiveHeading; exports.createOutlineStore = createOutlineStore; exports.navigateToHeading = navigateToHeading; exports.Outline = Outline; exports.tableOfContentsMarkdownIt = tableOfContentsMarkdownIt; exports.footnotesMarkdownIt = footnotesMarkdownIt; exports.tableOfContentsPluginKey = tableOfContentsPluginKey; exports.getTableOfContentsEntries = getTableOfContentsEntries; exports.TableOfContents = TableOfContents; exports.footnotesPluginKey = footnotesPluginKey; exports.getFootnotes = getFootnotes; exports.syncFootnotes = syncFootnotes; exports.FootnoteReference = FootnoteReference; exports.Footnotes = Footnotes; exports.Footnote = Footnote; exports.getBookmarks = getBookmarks; exports.Bookmark = Bookmark; exports.crossReferencePluginKey = crossReferencePluginKey; exports.getCrossReferenceTargets = getCrossReferenceTargets; exports.CrossReference = CrossReference; exports.documentStructureCommandItems = documentStructureCommandItems; exports.getDocumentStructureCommandItems = getDocumentStructureCommandItems; exports.FIND_PARAGRAPH_MARK = FIND_PARAGRAPH_MARK; exports.MAX_FIND_PATTERN_LENGTH = MAX_FIND_PATTERN_LENGTH; exports.createSearchBudget = createSearchBudget; exports.foldCodePoint = foldCodePoint; exports.compileFindPattern = compileFindPattern; exports.findAllMatches = findAllMatches; exports.parseReplacement = parseReplacement; exports.expandReplacement = expandReplacement; exports.searchDocument = searchDocument; exports.applyReplacements = applyReplacements; exports.EMPTY_FIND_REPLACE_SNAPSHOT = EMPTY_FIND_REPLACE_SNAPSHOT; exports.FindReplaceStore = FindReplaceStore; exports.findReplacePluginKey = findReplacePluginKey; exports.getFindReplaceState = getFindReplaceState; exports.getFindReplaceStore = getFindReplaceStore; exports.FIND_OPTION_TOGGLES = FIND_OPTION_TOGGLES; exports.formatFindStatus = formatFindStatus; exports.FindReplace = FindReplace; exports.STYLE_ID_ATTRIBUTE = STYLE_ID_ATTRIBUTE; exports.CHARACTER_STYLE_MARK_NAME = CHARACTER_STYLE_MARK_NAME; exports.paragraphStylesPluginKey = paragraphStylesPluginKey; exports.getStyleRegistry = getStyleRegistry; exports.isParagraphStyleAvailable = isParagraphStyleAvailable; exports.getParagraphStyleAt = getParagraphStyleAt; exports.captureSelectionFormat = captureSelectionFormat; exports.CharacterStyle = CharacterStyle; exports.ParagraphStyles = ParagraphStyles; exports.createParagraphStylesStore = createParagraphStylesStore; exports.createRichTextPreset = createRichTextPreset; exports.createFindReplaceCommands = createFindReplaceCommands; exports.validateFindPattern = validateFindPattern; exports.createTableCommands = createTableCommands;
7640
- //# sourceMappingURL=chunk-YOMYSFJU.cjs.map
7640
+ //# sourceMappingURL=chunk-LN2POBHT.cjs.map