@datawheel/bespoke 0.5.8 → 0.5.9

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 (2) hide show
  1. package/dist/index.js +180 -94
  2. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ import dynamic from 'next/dynamic';
33
33
  import { Plugin, PluginKey, Selection, TextSelection, NodeSelection } from '@tiptap/pm/state';
34
34
  import '@tiptap/pm/view';
35
35
  import '@tiptap/pm/keymap';
36
- import { Fragment as Fragment$2, Slice, DOMParser } from '@tiptap/pm/model';
36
+ import { Fragment as Fragment$2, Slice, Schema, DOMParser } from '@tiptap/pm/model';
37
37
  import { liftTarget, joinPoint, canSplit, ReplaceStep, ReplaceAroundStep, canJoin } from '@tiptap/pm/transform';
38
38
  import { createParagraphNear as createParagraphNear$1, deleteSelection as deleteSelection$1, exitCode as exitCode$1, joinUp as joinUp$1, joinDown as joinDown$1, joinBackward as joinBackward$1, joinForward as joinForward$1, joinTextblockBackward as joinTextblockBackward$1, joinTextblockForward as joinTextblockForward$1, lift as lift$1, liftEmptyBlock as liftEmptyBlock$1, newlineInCode as newlineInCode$1, selectNodeBackward as selectNodeBackward$1, selectNodeForward as selectNodeForward$1, selectParentNode as selectParentNode$1, selectTextblockEnd as selectTextblockEnd$1, selectTextblockStart as selectTextblockStart$1, setBlockType, wrapIn as wrapIn$1 } from '@tiptap/pm/commands';
39
39
  import { liftListItem as liftListItem$1, sinkListItem as sinkListItem$1, wrapInList as wrapInList$1 } from '@tiptap/pm/schema-list';
@@ -6615,14 +6615,10 @@ function mergeDeep(target, source) {
6615
6615
  const output = { ...target };
6616
6616
  if (isPlainObject(target) && isPlainObject(source)) {
6617
6617
  Object.keys(source).forEach((key) => {
6618
- if (isPlainObject(source[key])) {
6619
- if (!(key in target)) {
6620
- Object.assign(output, { [key]: source[key] });
6621
- } else {
6622
- output[key] = mergeDeep(target[key], source[key]);
6623
- }
6618
+ if (isPlainObject(source[key]) && isPlainObject(target[key])) {
6619
+ output[key] = mergeDeep(target[key], source[key]);
6624
6620
  } else {
6625
- Object.assign(output, { [key]: source[key] });
6621
+ output[key] = source[key];
6626
6622
  }
6627
6623
  });
6628
6624
  }
@@ -6632,15 +6628,13 @@ function getTextBetween(startNode, range, options) {
6632
6628
  const { from, to } = range;
6633
6629
  const { blockSeparator = "\n\n", textSerializers = {} } = options || {};
6634
6630
  let text = "";
6635
- let separated = true;
6636
6631
  startNode.nodesBetween(from, to, (node, pos, parent, index) => {
6637
6632
  var _a;
6633
+ if (node.isBlock && pos > from) {
6634
+ text += blockSeparator;
6635
+ }
6638
6636
  const textSerializer = textSerializers === null || textSerializers === void 0 ? void 0 : textSerializers[node.type.name];
6639
6637
  if (textSerializer) {
6640
- if (node.isBlock && !separated) {
6641
- text += blockSeparator;
6642
- separated = true;
6643
- }
6644
6638
  if (parent) {
6645
6639
  text += textSerializer({
6646
6640
  node,
@@ -6650,12 +6644,10 @@ function getTextBetween(startNode, range, options) {
6650
6644
  range
6651
6645
  });
6652
6646
  }
6653
- } else if (node.isText) {
6647
+ return false;
6648
+ }
6649
+ if (node.isText) {
6654
6650
  text += (_a = node === null || node === void 0 ? void 0 : node.text) === null || _a === void 0 ? void 0 : _a.slice(Math.max(from, pos) - pos, to - pos);
6655
- separated = false;
6656
- } else if (node.isBlock && !separated) {
6657
- text += blockSeparator;
6658
- separated = true;
6659
6651
  }
6660
6652
  });
6661
6653
  return text;
@@ -6774,20 +6766,63 @@ function createNodeFromContent(content, schema2, options) {
6774
6766
  parseOptions: {},
6775
6767
  ...options
6776
6768
  };
6777
- if (typeof content === "object" && content !== null) {
6769
+ const isJSONContent = typeof content === "object" && content !== null;
6770
+ const isTextContent = typeof content === "string";
6771
+ if (isJSONContent) {
6778
6772
  try {
6779
- if (Array.isArray(content) && content.length > 0) {
6773
+ const isArrayContent = Array.isArray(content) && content.length > 0;
6774
+ if (isArrayContent) {
6780
6775
  return Fragment$2.fromArray(content.map((item) => schema2.nodeFromJSON(item)));
6781
6776
  }
6782
6777
  return schema2.nodeFromJSON(content);
6783
6778
  } catch (error) {
6779
+ if (options.errorOnInvalidContent) {
6780
+ throw new Error("[tiptap error]: Invalid JSON content", { cause: error });
6781
+ }
6784
6782
  console.warn("[tiptap warn]: Invalid content.", "Passed value:", content, "Error:", error);
6785
6783
  return createNodeFromContent("", schema2, options);
6786
6784
  }
6787
6785
  }
6788
- if (typeof content === "string") {
6786
+ if (isTextContent) {
6787
+ if (options.errorOnInvalidContent) {
6788
+ let hasInvalidContent = false;
6789
+ let invalidContent = "";
6790
+ const contentCheckSchema = new Schema({
6791
+ topNode: schema2.spec.topNode,
6792
+ marks: schema2.spec.marks,
6793
+ // Prosemirror's schemas are executed such that: the last to execute, matches last
6794
+ // This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle
6795
+ nodes: schema2.spec.nodes.append({
6796
+ __tiptap__private__unknown__catch__all__node: {
6797
+ content: "inline*",
6798
+ group: "block",
6799
+ parseDOM: [
6800
+ {
6801
+ tag: "*",
6802
+ getAttrs: (e) => {
6803
+ hasInvalidContent = true;
6804
+ invalidContent = typeof e === "string" ? e : e.outerHTML;
6805
+ return null;
6806
+ }
6807
+ }
6808
+ ]
6809
+ }
6810
+ })
6811
+ });
6812
+ if (options.slice) {
6813
+ DOMParser.fromSchema(contentCheckSchema).parseSlice(elementFromString(content), options.parseOptions);
6814
+ } else {
6815
+ DOMParser.fromSchema(contentCheckSchema).parse(elementFromString(content), options.parseOptions);
6816
+ }
6817
+ if (options.errorOnInvalidContent && hasInvalidContent) {
6818
+ throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${invalidContent}`) });
6819
+ }
6820
+ }
6789
6821
  const parser = DOMParser.fromSchema(schema2);
6790
- return options.slice ? parser.parseSlice(elementFromString(content), options.parseOptions).content : parser.parse(elementFromString(content), options.parseOptions);
6822
+ if (options.slice) {
6823
+ return parser.parseSlice(elementFromString(content), options.parseOptions).content;
6824
+ }
6825
+ return parser.parse(elementFromString(content), options.parseOptions);
6791
6826
  }
6792
6827
  return createNodeFromContent("", schema2, options);
6793
6828
  }
@@ -6903,8 +6938,12 @@ function deleteProps(obj, propOrProps) {
6903
6938
  return newObj;
6904
6939
  }, {});
6905
6940
  }
6906
- function createDocument(content, schema2, parseOptions = {}) {
6907
- return createNodeFromContent(content, schema2, { slice: false, parseOptions });
6941
+ function createDocument(content, schema2, parseOptions = {}, options = {}) {
6942
+ return createNodeFromContent(content, schema2, {
6943
+ slice: false,
6944
+ parseOptions,
6945
+ errorOnInvalidContent: options.errorOnInvalidContent
6946
+ });
6908
6947
  }
6909
6948
  function getMarkAttributes(state, typeOrName) {
6910
6949
  const type = getMarkType(typeOrName, state.schema);
@@ -6955,7 +6994,7 @@ function getMarksBetween(from, to, doc) {
6955
6994
  const marks = [];
6956
6995
  if (from === to) {
6957
6996
  doc.resolve(from).marks().forEach((mark) => {
6958
- const $pos = doc.resolve(from - 1);
6997
+ const $pos = doc.resolve(from);
6959
6998
  const range = getMarkRange($pos, mark.type);
6960
6999
  if (!range) {
6961
7000
  return;
@@ -7147,7 +7186,8 @@ function nodeInputRule(config) {
7147
7186
  tr.insertText(lastChar, start2 + match[0].length - 1);
7148
7187
  tr.replaceWith(matchStart, end2, newNode);
7149
7188
  } else if (match[0]) {
7150
- tr.insert(start2 - 1, config.type.create(attributes)).delete(tr.mapping.map(start2), tr.mapping.map(end2));
7189
+ const insertionStart = config.type.isInline ? start2 : start2 - 1;
7190
+ tr.insert(insertionStart, config.type.create(attributes)).delete(tr.mapping.map(start2), tr.mapping.map(end2));
7151
7191
  }
7152
7192
  tr.scrollIntoView();
7153
7193
  }
@@ -7334,12 +7374,14 @@ var init_dist = __esm({
7334
7374
  return new Extension(config);
7335
7375
  }
7336
7376
  configure(options = {}) {
7337
- const extension = this.extend();
7338
- extension.options = mergeDeep(this.options, options);
7339
- extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
7340
- name: extension.name,
7341
- options: extension.options
7342
- }));
7377
+ const extension = this.extend({
7378
+ ...this.config,
7379
+ addOptions: () => {
7380
+ return mergeDeep(this.options, options);
7381
+ }
7382
+ });
7383
+ extension.name = this.name;
7384
+ extension.parent = this.parent;
7343
7385
  return extension;
7344
7386
  }
7345
7387
  extend(extendedConfig = {}) {
@@ -7347,7 +7389,7 @@ var init_dist = __esm({
7347
7389
  extension.parent = this;
7348
7390
  this.child = extension;
7349
7391
  extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
7350
- if (extendedConfig.defaultOptions) {
7392
+ if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
7351
7393
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
7352
7394
  }
7353
7395
  extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
@@ -7362,6 +7404,11 @@ var init_dist = __esm({
7362
7404
  };
7363
7405
  Extension.create({
7364
7406
  name: "clipboardTextSerializer",
7407
+ addOptions() {
7408
+ return {
7409
+ blockSeparator: void 0
7410
+ };
7411
+ },
7365
7412
  addProseMirrorPlugins() {
7366
7413
  return [
7367
7414
  new Plugin({
@@ -7377,6 +7424,7 @@ var init_dist = __esm({
7377
7424
  const textSerializers = getTextSerializersFromSchema(schema2);
7378
7425
  const range = { from, to };
7379
7426
  return getTextBetween(doc, range, {
7427
+ ...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
7380
7428
  textSerializers
7381
7429
  });
7382
7430
  }
@@ -7574,23 +7622,36 @@ var init_dist = __esm({
7574
7622
  return node;
7575
7623
  };
7576
7624
  isFragment = (nodeOrFragment) => {
7577
- return nodeOrFragment.toString().startsWith("<");
7625
+ return !("type" in nodeOrFragment);
7578
7626
  };
7579
7627
  insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {
7628
+ var _a;
7580
7629
  if (dispatch) {
7581
7630
  options = {
7582
7631
  parseOptions: {},
7583
7632
  updateSelection: true,
7633
+ applyInputRules: false,
7634
+ applyPasteRules: false,
7584
7635
  ...options
7585
7636
  };
7586
- const content = createNodeFromContent(value, editor.schema, {
7587
- parseOptions: {
7588
- preserveWhitespace: "full",
7589
- ...options.parseOptions
7590
- }
7591
- });
7592
- if (content.toString() === "<>") {
7593
- return true;
7637
+ let content;
7638
+ try {
7639
+ content = createNodeFromContent(value, editor.schema, {
7640
+ parseOptions: {
7641
+ preserveWhitespace: "full",
7642
+ ...options.parseOptions
7643
+ },
7644
+ errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck
7645
+ });
7646
+ } catch (e) {
7647
+ editor.emit("contentError", {
7648
+ editor,
7649
+ error: e,
7650
+ disableCollaboration: () => {
7651
+ console.error("[tiptap error]: Unable to disable collaboration at this point in time");
7652
+ }
7653
+ });
7654
+ return false;
7594
7655
  }
7595
7656
  let { from, to } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
7596
7657
  let isOnlyTextContent = true;
@@ -7609,20 +7670,29 @@ var init_dist = __esm({
7609
7670
  to += 1;
7610
7671
  }
7611
7672
  }
7673
+ let newContent;
7612
7674
  if (isOnlyTextContent) {
7613
7675
  if (Array.isArray(value)) {
7614
- tr.insertText(value.map((v2) => v2.text || "").join(""), from, to);
7676
+ newContent = value.map((v2) => v2.text || "").join("");
7615
7677
  } else if (typeof value === "object" && !!value && !!value.text) {
7616
- tr.insertText(value.text, from, to);
7678
+ newContent = value.text;
7617
7679
  } else {
7618
- tr.insertText(value, from, to);
7680
+ newContent = value;
7619
7681
  }
7682
+ tr.insertText(newContent, from, to);
7620
7683
  } else {
7621
- tr.replaceWith(from, to, content);
7684
+ newContent = content;
7685
+ tr.replaceWith(from, to, newContent);
7622
7686
  }
7623
7687
  if (options.updateSelection) {
7624
7688
  selectionToInsertionEnd(tr, tr.steps.length - 1, -1);
7625
7689
  }
7690
+ if (options.applyInputRules) {
7691
+ tr.setMeta("applyInputRules", { from, text: newContent });
7692
+ }
7693
+ if (options.applyPasteRules) {
7694
+ tr.setMeta("applyPasteRules", { from, text: newContent });
7695
+ }
7626
7696
  }
7627
7697
  return true;
7628
7698
  };
@@ -7638,7 +7708,7 @@ var init_dist = __esm({
7638
7708
  joinForward = () => ({ state, dispatch }) => {
7639
7709
  return joinForward$1(state, dispatch);
7640
7710
  };
7641
- joinItemBackward = () => ({ tr, state, dispatch }) => {
7711
+ joinItemBackward = () => ({ state, dispatch, tr }) => {
7642
7712
  try {
7643
7713
  const point = joinPoint(state.doc, state.selection.$from.pos, -1);
7644
7714
  if (point === null || point === void 0) {
@@ -7649,7 +7719,7 @@ var init_dist = __esm({
7649
7719
  dispatch(tr);
7650
7720
  }
7651
7721
  return true;
7652
- } catch {
7722
+ } catch (e) {
7653
7723
  return false;
7654
7724
  }
7655
7725
  };
@@ -7773,13 +7843,25 @@ var init_dist = __esm({
7773
7843
  selectTextblockStart = () => ({ state, dispatch }) => {
7774
7844
  return selectTextblockStart$1(state, dispatch);
7775
7845
  };
7776
- setContent = (content, emitUpdate = false, parseOptions = {}) => ({ tr, editor, dispatch }) => {
7846
+ setContent = (content, emitUpdate = false, parseOptions = {}, options = {}) => ({ editor, tr, dispatch, commands: commands2 }) => {
7847
+ var _a, _b;
7777
7848
  const { doc } = tr;
7778
- const document2 = createDocument(content, editor.schema, parseOptions);
7849
+ if (parseOptions.preserveWhitespace !== "full") {
7850
+ const document2 = createDocument(content, editor.schema, parseOptions, {
7851
+ errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck
7852
+ });
7853
+ if (dispatch) {
7854
+ tr.replaceWith(0, doc.content.size, document2).setMeta("preventUpdate", !emitUpdate);
7855
+ }
7856
+ return true;
7857
+ }
7779
7858
  if (dispatch) {
7780
- tr.replaceWith(0, doc.content.size, document2).setMeta("preventUpdate", !emitUpdate);
7859
+ tr.setMeta("preventUpdate", !emitUpdate);
7781
7860
  }
7782
- return true;
7861
+ return commands2.insertContentAt({ from: 0, to: doc.content.size }, content, {
7862
+ parseOptions,
7863
+ errorOnInvalidContent: (_b = options.errorOnInvalidContent) !== null && _b !== void 0 ? _b : editor.options.enableContentCheck
7864
+ });
7783
7865
  };
7784
7866
  setMark = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
7785
7867
  const { selection } = tr;
@@ -7884,29 +7966,29 @@ var init_dist = __esm({
7884
7966
  if (!$from.parent.isBlock) {
7885
7967
  return false;
7886
7968
  }
7887
- if (dispatch) {
7888
- const atEnd = $to.parentOffset === $to.parent.content.size;
7889
- if (selection instanceof TextSelection) {
7890
- tr.deleteSelection();
7969
+ const atEnd = $to.parentOffset === $to.parent.content.size;
7970
+ const deflt = $from.depth === 0 ? void 0 : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));
7971
+ let types = atEnd && deflt ? [
7972
+ {
7973
+ type: deflt,
7974
+ attrs: newAttributes
7891
7975
  }
7892
- const deflt = $from.depth === 0 ? void 0 : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));
7893
- let types = atEnd && deflt ? [
7976
+ ] : void 0;
7977
+ let can = canSplit(tr.doc, tr.mapping.map($from.pos), 1, types);
7978
+ if (!types && !can && canSplit(tr.doc, tr.mapping.map($from.pos), 1, deflt ? [{ type: deflt }] : void 0)) {
7979
+ can = true;
7980
+ types = deflt ? [
7894
7981
  {
7895
7982
  type: deflt,
7896
7983
  attrs: newAttributes
7897
7984
  }
7898
7985
  ] : void 0;
7899
- let can = canSplit(tr.doc, tr.mapping.map($from.pos), 1, types);
7900
- if (!types && !can && canSplit(tr.doc, tr.mapping.map($from.pos), 1, deflt ? [{ type: deflt }] : void 0)) {
7901
- can = true;
7902
- types = deflt ? [
7903
- {
7904
- type: deflt,
7905
- attrs: newAttributes
7906
- }
7907
- ] : void 0;
7908
- }
7986
+ }
7987
+ if (dispatch) {
7909
7988
  if (can) {
7989
+ if (selection instanceof TextSelection) {
7990
+ tr.deleteSelection();
7991
+ }
7910
7992
  tr.split(tr.mapping.map($from.pos), 1, types);
7911
7993
  if (deflt && !atEnd && !$from.parentOffset && $from.parent.type !== deflt) {
7912
7994
  const first2 = tr.mapping.map($from.before());
@@ -7921,7 +8003,7 @@ var init_dist = __esm({
7921
8003
  }
7922
8004
  tr.scrollIntoView();
7923
8005
  }
7924
- return true;
8006
+ return can;
7925
8007
  };
7926
8008
  splitListItem = (typeOrName) => ({ tr, state, dispatch, editor }) => {
7927
8009
  var _a;
@@ -8226,14 +8308,14 @@ var init_dist = __esm({
8226
8308
  forEach,
8227
8309
  insertContent,
8228
8310
  insertContentAt,
8229
- joinUp,
8230
- joinDown,
8231
8311
  joinBackward,
8312
+ joinDown,
8232
8313
  joinForward,
8233
8314
  joinItemBackward,
8234
8315
  joinItemForward,
8235
8316
  joinTextblockBackward,
8236
8317
  joinTextblockForward,
8318
+ joinUp,
8237
8319
  keyboardShortcut,
8238
8320
  lift,
8239
8321
  liftEmptyBlock,
@@ -8325,11 +8407,11 @@ var init_dist = __esm({
8325
8407
  const { selection, doc } = tr;
8326
8408
  const { empty, $anchor } = selection;
8327
8409
  const { pos, parent } = $anchor;
8328
- const $parentPos = $anchor.parent.isTextblock ? tr.doc.resolve(pos - 1) : $anchor;
8410
+ const $parentPos = $anchor.parent.isTextblock && pos > 0 ? tr.doc.resolve(pos - 1) : $anchor;
8329
8411
  const parentIsIsolating = $parentPos.parent.type.spec.isolating;
8330
8412
  const parentPos = $anchor.pos - $anchor.parentOffset;
8331
8413
  const isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : Selection.atStart(doc).from === pos;
8332
- if (!empty || !isAtStart || !parent.type.isTextblock || parent.textContent.length) {
8414
+ if (!empty || !parent.type.isTextblock || parent.textContent.length || !isAtStart || isAtStart && $anchor.parent.type.name === "paragraph") {
8333
8415
  return false;
8334
8416
  }
8335
8417
  return commands2.clearNodes();
@@ -8430,7 +8512,7 @@ var init_dist = __esm({
8430
8512
  new Plugin({
8431
8513
  key: new PluginKey("tabindex"),
8432
8514
  props: {
8433
- attributes: this.editor.isEditable ? { tabindex: "0" } : {}
8515
+ attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
8434
8516
  }
8435
8517
  })
8436
8518
  ];
@@ -8469,20 +8551,22 @@ var init_dist = __esm({
8469
8551
  return new Mark(config);
8470
8552
  }
8471
8553
  configure(options = {}) {
8472
- const extension = this.extend();
8473
- extension.options = mergeDeep(this.options, options);
8474
- extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
8475
- name: extension.name,
8476
- options: extension.options
8477
- }));
8554
+ const extension = this.extend({
8555
+ ...this.config,
8556
+ addOptions: () => {
8557
+ return mergeDeep(this.options, options);
8558
+ }
8559
+ });
8560
+ extension.name = this.name;
8561
+ extension.parent = this.parent;
8478
8562
  return extension;
8479
8563
  }
8480
8564
  extend(extendedConfig = {}) {
8481
- const extension = new Mark({ ...this.config, ...extendedConfig });
8565
+ const extension = new Mark(extendedConfig);
8482
8566
  extension.parent = this;
8483
8567
  this.child = extension;
8484
8568
  extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
8485
- if (extendedConfig.defaultOptions) {
8569
+ if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
8486
8570
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
8487
8571
  }
8488
8572
  extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
@@ -8548,20 +8632,22 @@ var init_dist = __esm({
8548
8632
  return new Node(config);
8549
8633
  }
8550
8634
  configure(options = {}) {
8551
- const extension = this.extend();
8552
- extension.options = mergeDeep(this.options, options);
8553
- extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
8554
- name: extension.name,
8555
- options: extension.options
8556
- }));
8635
+ const extension = this.extend({
8636
+ ...this.config,
8637
+ addOptions: () => {
8638
+ return mergeDeep(this.options, options);
8639
+ }
8640
+ });
8641
+ extension.name = this.name;
8642
+ extension.parent = this.parent;
8557
8643
  return extension;
8558
8644
  }
8559
8645
  extend(extendedConfig = {}) {
8560
- const extension = new Node({ ...this.config, ...extendedConfig });
8646
+ const extension = new Node(extendedConfig);
8561
8647
  extension.parent = this;
8562
8648
  this.child = extension;
8563
8649
  extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
8564
- if (extendedConfig.defaultOptions) {
8650
+ if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
8565
8651
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
8566
8652
  }
8567
8653
  extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
@@ -8583,10 +8669,10 @@ var init_dist2 = __esm({
8583
8669
  "../../node_modules/@tiptap/extension-bold/dist/index.js"() {
8584
8670
  init_esm_shims();
8585
8671
  init_dist();
8586
- starInputRegex = /(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/;
8587
- starPasteRegex = /(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g;
8588
- underscoreInputRegex = /(?:^|\s)((?:__)((?:[^__]+))(?:__))$/;
8589
- underscorePasteRegex = /(?:^|\s)((?:__)((?:[^__]+))(?:__))/g;
8672
+ starInputRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/;
8673
+ starPasteRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g;
8674
+ underscoreInputRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/;
8675
+ underscorePasteRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g;
8590
8676
  Bold = Mark.create({
8591
8677
  name: "bold",
8592
8678
  addOptions() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datawheel/bespoke",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "description": "Content management system for creating automated data reports",
5
5
  "exports": {
6
6
  ".": {
@@ -53,17 +53,17 @@
53
53
  "@monaco-editor/react": "^4.4.5",
54
54
  "@reduxjs/toolkit": "^1.8.4",
55
55
  "@tabler/icons-react": "^2.15.0",
56
- "@tiptap/extension-hard-break": "^2.2.2",
57
- "@tiptap/extension-history": "^2.2.2",
58
- "@tiptap/extension-mention": "^2.2.2",
59
- "@tiptap/extension-placeholder": "^2.2.4",
60
- "@tiptap/extension-text-align": "^2.2.2",
61
- "@tiptap/extension-typography": "^2.2.4",
62
- "@tiptap/extension-underline": "^2.2.2",
63
- "@tiptap/pm": "^2.2.2",
64
- "@tiptap/react": "^2.2.2",
65
- "@tiptap/starter-kit": "^2.2.2",
66
- "@tiptap/suggestion": "^2.2.2",
56
+ "@tiptap/extension-hard-break": "^2.5.9",
57
+ "@tiptap/extension-history": "^2.5.9",
58
+ "@tiptap/extension-mention": "^2.5.9",
59
+ "@tiptap/extension-placeholder": "^2.5.9",
60
+ "@tiptap/extension-text-align": "^2.5.9",
61
+ "@tiptap/extension-typography": "^2.5.9",
62
+ "@tiptap/extension-underline": "^2.5.9",
63
+ "@tiptap/pm": "^2.5.9",
64
+ "@tiptap/react": "^2.5.9",
65
+ "@tiptap/starter-kit": "^2.5.9",
66
+ "@tiptap/suggestion": "^2.5.9",
67
67
  "auth0": "^3.3",
68
68
  "axios": "^1.6.2",
69
69
  "axios-retry": "^3.8.0",