@tldraw/commenting 5.7.0-canary.1ca96321df92 → 5.7.0-canary.1dad28c3f64f

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/commenting.css CHANGED
@@ -897,6 +897,8 @@ button.tlui-cmt-reaction:hover {
897
897
  flex: 1;
898
898
  min-height: 0;
899
899
  overflow-y: auto;
900
+ /* A row's hover wash has no bottom inset, so rows tile; this is the last row's 4px. */
901
+ padding-bottom: 4px;
900
902
  }
901
903
  .tlui-cmt-list__empty {
902
904
  /* extra 2px at the bottom of the list */
@@ -910,8 +912,9 @@ button.tlui-cmt-reaction:hover {
910
912
  display: flex;
911
913
  gap: 10px;
912
914
  width: 100%;
913
- /* No top padding: the 40px byline row supplies the space above the name, as on a thread card. */
914
- padding: 0 12px 8px;
915
+ /* No top padding: the 40px byline row supplies the space above the name, as on a thread card.
916
+ The 6px bottom matches the thread card text's trailing margin, so a row is as tall as a card. */
917
+ padding: 0 12px 6px;
915
918
  border: none;
916
919
  background: transparent;
917
920
  font: inherit;
package/dist-cjs/index.js CHANGED
@@ -145,7 +145,7 @@ var import_state = require("./canvas/state");
145
145
  var import_thread_state = require("./canvas/thread-state");
146
146
  (0, import_utils.registerTldrawLibraryVersion)(
147
147
  "@tldraw/commenting",
148
- "5.7.0-canary.1ca96321df92",
148
+ "5.7.0-canary.1dad28c3f64f",
149
149
  "cjs"
150
150
  );
151
151
  //# sourceMappingURL=index.js.map
@@ -24,7 +24,10 @@ __export(comment_extensions_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(comment_extensions_exports);
26
26
  var import_tldraw = require("tldraw");
27
- const commentTipTapExtensions = (0, import_tldraw.getTipTapDefaultExtensions)({ heading: false });
27
+ const TASK_EXTENSION_NAMES = /* @__PURE__ */ new Set([import_tldraw.TaskList.name, import_tldraw.TaskItem.name, import_tldraw.TaskItemToggleExtension.name]);
28
+ const commentTipTapExtensions = (0, import_tldraw.getTipTapDefaultExtensions)({ heading: false }).filter(
29
+ (extension) => !TASK_EXTENSION_NAMES.has(extension.name)
30
+ );
28
31
  const EMPTY_COMMENT = (0, import_tldraw.toRichText)("");
29
32
  function isCommentEmpty(richText) {
30
33
  if (richText.content.length === 0) return true;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ui/comment-extensions.ts"],
4
- "sourcesContent": ["import { getTipTapDefaultExtensions, TLRichText, toRichText } from 'tldraw'\n\n/**\n * tldraw's default rich-text extension set, minus headings \u2014 the deliberately limited set used for\n * both the comment composer and comment display. Comments support paragraphs, bold, italic, lists,\n * links, code, and highlight, but not headings. Built from tldraw's shared factory so the config\n * stays in lockstep with the text shape's defaults rather than drifting from a copy.\n */\nexport const commentTipTapExtensions = getTipTapDefaultExtensions({ heading: false })\n\n/** An empty comment document \u2014 the seed value for a fresh composer and its post-submit reset. */\nexport const EMPTY_COMMENT: TLRichText = toRichText('')\n\n/**\n * Whether a rich-text comment body has no text. Mirrors tldraw's private `isEmptyRichText`: an\n * empty doc can be encoded as an empty `content` array or a single empty paragraph.\n */\nexport function isCommentEmpty(richText: TLRichText): boolean {\n\tif (richText.content.length === 0) return true\n\tif (richText.content.length === 1) {\n\t\tconst node = richText.content[0] as any\n\t\tif (!node.content || node.content.length === 0) return true\n\t}\n\treturn false\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmE;AAQ5D,MAAM,8BAA0B,0CAA2B,EAAE,SAAS,MAAM,CAAC;AAG7E,MAAM,oBAA4B,0BAAW,EAAE;AAM/C,SAAS,eAAe,UAA+B;AAC7D,MAAI,SAAS,QAAQ,WAAW,EAAG,QAAO;AAC1C,MAAI,SAAS,QAAQ,WAAW,GAAG;AAClC,UAAM,OAAO,SAAS,QAAQ,CAAC;AAC/B,QAAI,CAAC,KAAK,WAAW,KAAK,QAAQ,WAAW,EAAG,QAAO;AAAA,EACxD;AACA,SAAO;AACR;",
4
+ "sourcesContent": ["import {\n\tgetTipTapDefaultExtensions,\n\tTaskItem,\n\tTaskItemToggleExtension,\n\tTaskList,\n\tTLRichText,\n\ttoRichText,\n} from 'tldraw'\n\n// A posted comment is static HTML with nothing to write a click back to, so a checkbox there would\n// toggle on screen and snap back.\nconst TASK_EXTENSION_NAMES = new Set([TaskList.name, TaskItem.name, TaskItemToggleExtension.name])\n\n/**\n * tldraw's default rich-text extension set, minus headings and task lists \u2014 the deliberately\n * limited set used for both the comment composer and comment display. Comments support paragraphs,\n * bold, italic, lists, links, code, and highlight. Built from tldraw's shared factory so the config\n * stays in lockstep with the text shape's defaults rather than drifting from a copy.\n */\nexport const commentTipTapExtensions = getTipTapDefaultExtensions({ heading: false }).filter(\n\t(extension) => !TASK_EXTENSION_NAMES.has(extension.name)\n)\n\n/** An empty comment document \u2014 the seed value for a fresh composer and its post-submit reset. */\nexport const EMPTY_COMMENT: TLRichText = toRichText('')\n\n/**\n * Whether a rich-text comment body has no text. Mirrors tldraw's private `isEmptyRichText`: an\n * empty doc can be encoded as an empty `content` array or a single empty paragraph.\n */\nexport function isCommentEmpty(richText: TLRichText): boolean {\n\tif (richText.content.length === 0) return true\n\tif (richText.content.length === 1) {\n\t\tconst node = richText.content[0] as any\n\t\tif (!node.content || node.content.length === 0) return true\n\t}\n\treturn false\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAOO;AAIP,MAAM,uBAAuB,oBAAI,IAAI,CAAC,uBAAS,MAAM,uBAAS,MAAM,sCAAwB,IAAI,CAAC;AAQ1F,MAAM,8BAA0B,0CAA2B,EAAE,SAAS,MAAM,CAAC,EAAE;AAAA,EACrF,CAAC,cAAc,CAAC,qBAAqB,IAAI,UAAU,IAAI;AACxD;AAGO,MAAM,oBAA4B,0BAAW,EAAE;AAM/C,SAAS,eAAe,UAA+B;AAC7D,MAAI,SAAS,QAAQ,WAAW,EAAG,QAAO;AAC1C,MAAI,SAAS,QAAQ,WAAW,GAAG;AAClC,UAAM,OAAO,SAAS,QAAQ,CAAC;AAC/B,QAAI,CAAC,KAAK,WAAW,KAAK,QAAQ,WAAW,EAAG,QAAO;AAAA,EACxD;AACA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -108,7 +108,7 @@ import {
108
108
  import { anchorPagePoint, focusThread, shapeAnchorAt } from "./canvas/thread-state.mjs";
109
109
  registerTldrawLibraryVersion(
110
110
  "@tldraw/commenting",
111
- "5.7.0-canary.1ca96321df92",
111
+ "5.7.0-canary.1dad28c3f64f",
112
112
  "esm"
113
113
  );
114
114
  export {
@@ -1,5 +1,14 @@
1
- import { getTipTapDefaultExtensions, toRichText } from "tldraw";
2
- const commentTipTapExtensions = getTipTapDefaultExtensions({ heading: false });
1
+ import {
2
+ getTipTapDefaultExtensions,
3
+ TaskItem,
4
+ TaskItemToggleExtension,
5
+ TaskList,
6
+ toRichText
7
+ } from "tldraw";
8
+ const TASK_EXTENSION_NAMES = /* @__PURE__ */ new Set([TaskList.name, TaskItem.name, TaskItemToggleExtension.name]);
9
+ const commentTipTapExtensions = getTipTapDefaultExtensions({ heading: false }).filter(
10
+ (extension) => !TASK_EXTENSION_NAMES.has(extension.name)
11
+ );
3
12
  const EMPTY_COMMENT = toRichText("");
4
13
  function isCommentEmpty(richText) {
5
14
  if (richText.content.length === 0) return true;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ui/comment-extensions.ts"],
4
- "sourcesContent": ["import { getTipTapDefaultExtensions, TLRichText, toRichText } from 'tldraw'\n\n/**\n * tldraw's default rich-text extension set, minus headings \u2014 the deliberately limited set used for\n * both the comment composer and comment display. Comments support paragraphs, bold, italic, lists,\n * links, code, and highlight, but not headings. Built from tldraw's shared factory so the config\n * stays in lockstep with the text shape's defaults rather than drifting from a copy.\n */\nexport const commentTipTapExtensions = getTipTapDefaultExtensions({ heading: false })\n\n/** An empty comment document \u2014 the seed value for a fresh composer and its post-submit reset. */\nexport const EMPTY_COMMENT: TLRichText = toRichText('')\n\n/**\n * Whether a rich-text comment body has no text. Mirrors tldraw's private `isEmptyRichText`: an\n * empty doc can be encoded as an empty `content` array or a single empty paragraph.\n */\nexport function isCommentEmpty(richText: TLRichText): boolean {\n\tif (richText.content.length === 0) return true\n\tif (richText.content.length === 1) {\n\t\tconst node = richText.content[0] as any\n\t\tif (!node.content || node.content.length === 0) return true\n\t}\n\treturn false\n}\n"],
5
- "mappings": "AAAA,SAAS,4BAAwC,kBAAkB;AAQ5D,MAAM,0BAA0B,2BAA2B,EAAE,SAAS,MAAM,CAAC;AAG7E,MAAM,gBAA4B,WAAW,EAAE;AAM/C,SAAS,eAAe,UAA+B;AAC7D,MAAI,SAAS,QAAQ,WAAW,EAAG,QAAO;AAC1C,MAAI,SAAS,QAAQ,WAAW,GAAG;AAClC,UAAM,OAAO,SAAS,QAAQ,CAAC;AAC/B,QAAI,CAAC,KAAK,WAAW,KAAK,QAAQ,WAAW,EAAG,QAAO;AAAA,EACxD;AACA,SAAO;AACR;",
4
+ "sourcesContent": ["import {\n\tgetTipTapDefaultExtensions,\n\tTaskItem,\n\tTaskItemToggleExtension,\n\tTaskList,\n\tTLRichText,\n\ttoRichText,\n} from 'tldraw'\n\n// A posted comment is static HTML with nothing to write a click back to, so a checkbox there would\n// toggle on screen and snap back.\nconst TASK_EXTENSION_NAMES = new Set([TaskList.name, TaskItem.name, TaskItemToggleExtension.name])\n\n/**\n * tldraw's default rich-text extension set, minus headings and task lists \u2014 the deliberately\n * limited set used for both the comment composer and comment display. Comments support paragraphs,\n * bold, italic, lists, links, code, and highlight. Built from tldraw's shared factory so the config\n * stays in lockstep with the text shape's defaults rather than drifting from a copy.\n */\nexport const commentTipTapExtensions = getTipTapDefaultExtensions({ heading: false }).filter(\n\t(extension) => !TASK_EXTENSION_NAMES.has(extension.name)\n)\n\n/** An empty comment document \u2014 the seed value for a fresh composer and its post-submit reset. */\nexport const EMPTY_COMMENT: TLRichText = toRichText('')\n\n/**\n * Whether a rich-text comment body has no text. Mirrors tldraw's private `isEmptyRichText`: an\n * empty doc can be encoded as an empty `content` array or a single empty paragraph.\n */\nexport function isCommentEmpty(richText: TLRichText): boolean {\n\tif (richText.content.length === 0) return true\n\tif (richText.content.length === 1) {\n\t\tconst node = richText.content[0] as any\n\t\tif (!node.content || node.content.length === 0) return true\n\t}\n\treturn false\n}\n"],
5
+ "mappings": "AAAA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,OACM;AAIP,MAAM,uBAAuB,oBAAI,IAAI,CAAC,SAAS,MAAM,SAAS,MAAM,wBAAwB,IAAI,CAAC;AAQ1F,MAAM,0BAA0B,2BAA2B,EAAE,SAAS,MAAM,CAAC,EAAE;AAAA,EACrF,CAAC,cAAc,CAAC,qBAAqB,IAAI,UAAU,IAAI;AACxD;AAGO,MAAM,gBAA4B,WAAW,EAAE;AAM/C,SAAS,eAAe,UAA+B;AAC7D,MAAI,SAAS,QAAQ,WAAW,EAAG,QAAO;AAC1C,MAAI,SAAS,QAAQ,WAAW,GAAG;AAClC,UAAM,OAAO,SAAS,QAAQ,CAAC;AAC/B,QAAI,CAAC,KAAK,WAAW,KAAK,QAAQ,WAAW,EAAG,QAAO;AAAA,EACxD;AACA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tldraw/commenting",
3
3
  "description": "tldraw commenting UI components.",
4
- "version": "5.7.0-canary.1ca96321df92",
4
+ "version": "5.7.0-canary.1dad28c3f64f",
5
5
  "author": {
6
6
  "name": "tldraw Inc.",
7
7
  "email": "hello@tldraw.com"
@@ -32,7 +32,7 @@
32
32
  "src"
33
33
  ],
34
34
  "devDependencies": {
35
- "@tldraw/driver": "5.7.0-canary.1ca96321df92",
35
+ "@tldraw/driver": "5.7.0-canary.1dad28c3f64f",
36
36
  "@types/react": "^19.2.7",
37
37
  "@types/react-dom": "^19.2.3",
38
38
  "react": "^19.2.1",
@@ -50,9 +50,9 @@
50
50
  "@tiptap/core": "^3.12.1",
51
51
  "@tiptap/pm": "^3.12.1",
52
52
  "@tiptap/react": "^3.12.1",
53
- "@tldraw/mentions": "5.7.0-canary.1ca96321df92",
54
- "@tldraw/utils": "5.7.0-canary.1ca96321df92",
55
- "tldraw": "5.7.0-canary.1ca96321df92"
53
+ "@tldraw/mentions": "5.7.0-canary.1dad28c3f64f",
54
+ "@tldraw/utils": "5.7.0-canary.1dad28c3f64f",
55
+ "tldraw": "5.7.0-canary.1dad28c3f64f"
56
56
  },
57
57
  "module": "dist-esm/index.mjs",
58
58
  "source": "src/index.ts",
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, it } from 'vitest'
2
- import { EMPTY_COMMENT, isCommentEmpty } from '../ui/comment-extensions'
2
+ import { commentTipTapExtensions, EMPTY_COMMENT, isCommentEmpty } from '../ui/comment-extensions'
3
3
  import { renderCommentHtml, renderCommentPlaintext } from './comment-render'
4
4
 
5
5
  const doc = (...content: any[]) => ({ type: 'doc', content }) as any
@@ -26,6 +26,13 @@ describe('renderCommentHtml', () => {
26
26
  expect(list).toContain('one')
27
27
  })
28
28
 
29
+ it('leaves task lists out of the limited set', () => {
30
+ // A posted comment is static HTML, so its checkboxes would toggle and never write back.
31
+ expect(commentTipTapExtensions.map((extension) => extension.name)).not.toEqual(
32
+ expect.arrayContaining([expect.stringMatching(/^task/)])
33
+ )
34
+ })
35
+
29
36
  it('renders a heading node as a paragraph, never a heading', () => {
30
37
  const html = renderCommentHtml(
31
38
  doc({ type: 'heading', attrs: { level: 1 }, content: [text('Title')] })
@@ -1,12 +1,25 @@
1
- import { getTipTapDefaultExtensions, TLRichText, toRichText } from 'tldraw'
1
+ import {
2
+ getTipTapDefaultExtensions,
3
+ TaskItem,
4
+ TaskItemToggleExtension,
5
+ TaskList,
6
+ TLRichText,
7
+ toRichText,
8
+ } from 'tldraw'
9
+
10
+ // A posted comment is static HTML with nothing to write a click back to, so a checkbox there would
11
+ // toggle on screen and snap back.
12
+ const TASK_EXTENSION_NAMES = new Set([TaskList.name, TaskItem.name, TaskItemToggleExtension.name])
2
13
 
3
14
  /**
4
- * tldraw's default rich-text extension set, minus headings — the deliberately limited set used for
5
- * both the comment composer and comment display. Comments support paragraphs, bold, italic, lists,
6
- * links, code, and highlight, but not headings. Built from tldraw's shared factory so the config
15
+ * tldraw's default rich-text extension set, minus headings and task lists — the deliberately
16
+ * limited set used for both the comment composer and comment display. Comments support paragraphs,
17
+ * bold, italic, lists, links, code, and highlight. Built from tldraw's shared factory so the config
7
18
  * stays in lockstep with the text shape's defaults rather than drifting from a copy.
8
19
  */
9
- export const commentTipTapExtensions = getTipTapDefaultExtensions({ heading: false })
20
+ export const commentTipTapExtensions = getTipTapDefaultExtensions({ heading: false }).filter(
21
+ (extension) => !TASK_EXTENSION_NAMES.has(extension.name)
22
+ )
10
23
 
11
24
  /** An empty comment document — the seed value for a fresh composer and its post-submit reset. */
12
25
  export const EMPTY_COMMENT: TLRichText = toRichText('')
@@ -794,6 +794,8 @@ button.tlui-cmt-reaction:hover {
794
794
  flex: 1;
795
795
  min-height: 0;
796
796
  overflow-y: auto;
797
+ /* A row's hover wash has no bottom inset, so rows tile; this is the last row's 4px. */
798
+ padding-bottom: 4px;
797
799
  }
798
800
  .tlui-cmt-list__empty {
799
801
  /* extra 2px at the bottom of the list */
@@ -807,8 +809,9 @@ button.tlui-cmt-reaction:hover {
807
809
  display: flex;
808
810
  gap: 10px;
809
811
  width: 100%;
810
- /* No top padding: the 40px byline row supplies the space above the name, as on a thread card. */
811
- padding: 0 12px 8px;
812
+ /* No top padding: the 40px byline row supplies the space above the name, as on a thread card.
813
+ The 6px bottom matches the thread card text's trailing margin, so a row is as tall as a card. */
814
+ padding: 0 12px 6px;
812
815
  border: none;
813
816
  background: transparent;
814
817
  font: inherit;