@tiptap/core 3.20.2 → 3.20.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/core",
3
3
  "description": "headless rich text editor",
4
- "version": "3.20.2",
4
+ "version": "3.20.3",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -52,10 +52,10 @@
52
52
  "jsx-dev-runtime"
53
53
  ],
54
54
  "devDependencies": {
55
- "@tiptap/pm": "^3.20.2"
55
+ "@tiptap/pm": "^3.20.3"
56
56
  },
57
57
  "peerDependencies": {
58
- "@tiptap/pm": "^3.20.2"
58
+ "@tiptap/pm": "^3.20.3"
59
59
  },
60
60
  "repository": {
61
61
  "type": "git",
package/src/Extendable.ts CHANGED
@@ -291,6 +291,28 @@ export interface ExtendableConfig<
291
291
  * Defines if this markdown element should indent it's child elements
292
292
  */
293
293
  indentsContent?: boolean
294
+
295
+ /**
296
+ * Lets a mark tell the Markdown serializer which inline HTML tags it can
297
+ * safely use when plain markdown delimiters would become ambiguous.
298
+ *
299
+ * This is mainly useful for overlapping marks. For example, bold followed
300
+ * by bold+italic followed by italic cannot always be written back with only
301
+ * `*` and `**` in a way that still parses correctly. In that case, the
302
+ * serializer can close the overlapping section with markdown and reopen the
303
+ * remaining tail with HTML instead.
304
+ *
305
+ * Example:
306
+ * - desired formatting: `**123` + `*456*` + `789 italic`
307
+ * - serialized result: `**123*456***<em>789</em>`
308
+ *
309
+ * If your extension defines custom mark names, set `htmlReopen` on that
310
+ * extension so the serializer can reuse its HTML form for overlap cases.
311
+ */
312
+ htmlReopen?: {
313
+ open: string
314
+ close: string
315
+ }
294
316
  }
295
317
 
296
318
  /**
@@ -25,7 +25,7 @@ export function isNodeEmpty(
25
25
  return true
26
26
  }
27
27
  if (node.isText) {
28
- return /^\s*$/m.test(node.text ?? '')
28
+ return !/\S/.test(node.text ?? '')
29
29
  }
30
30
  }
31
31
 
package/src/types.ts CHANGED
@@ -959,6 +959,10 @@ export interface MarkdownExtensionSpec {
959
959
  parseMarkdown?: (token: MarkdownToken, helpers: MarkdownParseHelpers) => MarkdownParseResult
960
960
  renderMarkdown?: (node: any, helpers: MarkdownRendererHelpers, ctx: RenderContext) => string
961
961
  isIndenting?: boolean
962
+ htmlReopen?: {
963
+ open: string
964
+ close: string
965
+ }
962
966
  /** Custom tokenizer for marked.js to handle non-standard markdown syntax */
963
967
  tokenizer?: MarkdownTokenizer
964
968
  }