notra-editor 0.6.0 → 0.7.0

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 (96) hide show
  1. package/dist/components/blockquote-button/blockquote-button.d.cts +2 -2
  2. package/dist/components/blockquote-button/blockquote-button.d.ts +2 -2
  3. package/dist/components/code-block-button/code-block-button.d.cts +2 -2
  4. package/dist/components/code-block-button/code-block-button.d.ts +2 -2
  5. package/dist/components/heading-dropdown-menu/heading-dropdown-menu.d.cts +2 -2
  6. package/dist/components/heading-dropdown-menu/heading-dropdown-menu.d.ts +2 -2
  7. package/dist/components/heading-dropdown-menu/heading-menu-item.d.cts +2 -2
  8. package/dist/components/heading-dropdown-menu/heading-menu-item.d.ts +2 -2
  9. package/dist/components/image-popover/image-popover.d.cts +2 -2
  10. package/dist/components/image-popover/image-popover.d.ts +2 -2
  11. package/dist/components/image-popover/use-image-popover.d.cts +3 -3
  12. package/dist/components/image-popover/use-image-popover.d.ts +3 -3
  13. package/dist/components/link-popover/link-popover.d.cts +2 -2
  14. package/dist/components/link-popover/link-popover.d.ts +2 -2
  15. package/dist/components/link-popover/use-link-popover.d.cts +2 -2
  16. package/dist/components/link-popover/use-link-popover.d.ts +2 -2
  17. package/dist/components/list-dropdown-menu/list-dropdown-menu.d.cts +2 -2
  18. package/dist/components/list-dropdown-menu/list-dropdown-menu.d.ts +2 -2
  19. package/dist/components/list-dropdown-menu/list-menu-item.d.cts +2 -2
  20. package/dist/components/list-dropdown-menu/list-menu-item.d.ts +2 -2
  21. package/dist/components/mark-button/mark-button.d.cts +2 -2
  22. package/dist/components/mark-button/mark-button.d.ts +2 -2
  23. package/dist/components/toolbar/toolbar.d.cts +2 -2
  24. package/dist/components/toolbar/toolbar.d.ts +2 -2
  25. package/dist/components/ui/button.d.cts +2 -2
  26. package/dist/components/ui/button.d.ts +2 -2
  27. package/dist/components/ui/command.cjs +92 -29
  28. package/dist/components/ui/command.cjs.map +1 -1
  29. package/dist/components/ui/command.d.cts +18 -8
  30. package/dist/components/ui/command.d.ts +18 -8
  31. package/dist/components/ui/command.mjs +95 -29
  32. package/dist/components/ui/command.mjs.map +1 -1
  33. package/dist/components/ui/dialog.cjs +188 -0
  34. package/dist/components/ui/dialog.cjs.map +1 -0
  35. package/dist/components/ui/dialog.d.cts +20 -0
  36. package/dist/components/ui/dialog.d.ts +20 -0
  37. package/dist/components/ui/dialog.mjs +155 -0
  38. package/dist/components/ui/dialog.mjs.map +1 -0
  39. package/dist/components/ui/dropdown-menu.cjs +3 -2
  40. package/dist/components/ui/dropdown-menu.cjs.map +1 -1
  41. package/dist/components/ui/dropdown-menu.d.cts +16 -16
  42. package/dist/components/ui/dropdown-menu.d.ts +16 -16
  43. package/dist/components/ui/dropdown-menu.mjs +3 -2
  44. package/dist/components/ui/dropdown-menu.mjs.map +1 -1
  45. package/dist/components/ui/input-group.cjs +175 -0
  46. package/dist/components/ui/input-group.cjs.map +1 -0
  47. package/dist/components/ui/input-group.d.cts +20 -0
  48. package/dist/components/ui/input-group.d.ts +20 -0
  49. package/dist/components/ui/input-group.mjs +146 -0
  50. package/dist/components/ui/input-group.mjs.map +1 -0
  51. package/dist/components/ui/input.cjs +1 -1
  52. package/dist/components/ui/input.cjs.map +1 -1
  53. package/dist/components/ui/input.d.cts +2 -2
  54. package/dist/components/ui/input.d.ts +2 -2
  55. package/dist/components/ui/input.mjs +1 -1
  56. package/dist/components/ui/input.mjs.map +1 -1
  57. package/dist/components/ui/popover.cjs +46 -6
  58. package/dist/components/ui/popover.cjs.map +1 -1
  59. package/dist/components/ui/popover.d.cts +9 -6
  60. package/dist/components/ui/popover.d.ts +9 -6
  61. package/dist/components/ui/popover.mjs +43 -6
  62. package/dist/components/ui/popover.mjs.map +1 -1
  63. package/dist/components/ui/separator.cjs +2 -1
  64. package/dist/components/ui/separator.cjs.map +1 -1
  65. package/dist/components/ui/separator.d.cts +2 -2
  66. package/dist/components/ui/separator.d.ts +2 -2
  67. package/dist/components/ui/separator.mjs +2 -1
  68. package/dist/components/ui/separator.mjs.map +1 -1
  69. package/dist/components/ui/textarea.cjs +43 -0
  70. package/dist/components/ui/textarea.cjs.map +1 -0
  71. package/dist/components/ui/textarea.d.cts +6 -0
  72. package/dist/components/ui/textarea.d.ts +6 -0
  73. package/dist/components/ui/textarea.mjs +19 -0
  74. package/dist/components/ui/textarea.mjs.map +1 -0
  75. package/dist/components/undo-redo-button/undo-redo-button.d.cts +2 -2
  76. package/dist/components/undo-redo-button/undo-redo-button.d.ts +2 -2
  77. package/dist/components/undo-redo-button/use-undo-redo.d.cts +2 -2
  78. package/dist/components/undo-redo-button/use-undo-redo.d.ts +2 -2
  79. package/dist/extensions/code-block.cjs.map +1 -1
  80. package/dist/extensions/code-block.mjs.map +1 -1
  81. package/dist/styles/globals.css +953 -205
  82. package/dist/themes/default/editor.css +69 -0
  83. package/dist/themes/default/shared.css +33 -0
  84. package/package.json +3 -1
  85. package/dist/icons/redo-icon.cjs +0 -54
  86. package/dist/icons/redo-icon.cjs.map +0 -1
  87. package/dist/icons/redo-icon.d.cts +0 -7
  88. package/dist/icons/redo-icon.d.ts +0 -7
  89. package/dist/icons/redo-icon.mjs +0 -30
  90. package/dist/icons/redo-icon.mjs.map +0 -1
  91. package/dist/icons/undo-icon.cjs +0 -54
  92. package/dist/icons/undo-icon.cjs.map +0 -1
  93. package/dist/icons/undo-icon.d.cts +0 -7
  94. package/dist/icons/undo-icon.d.ts +0 -7
  95. package/dist/icons/undo-icon.mjs +0 -30
  96. package/dist/icons/undo-icon.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ui/separator.tsx"],"sourcesContent":["import { Separator as SeparatorPrimitive } from 'radix-ui';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\n\nfunction Separator({\n\tclassName,\n\torientation = 'horizontal',\n\tdecorative = true,\n\t...props\n}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {\n\treturn (\n\t\t<SeparatorPrimitive.Root\n\t\t\tclassName={cn(\n\t\t\t\t'nt:shrink-0 nt:bg-border nt:data-[orientation=horizontal]:h-px nt:data-[orientation=horizontal]:w-full nt:data-[orientation=vertical]:h-full nt:data-[orientation=vertical]:w-px',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tdata-slot=\"separator\"\n\t\t\tdecorative={decorative}\n\t\t\torientation={orientation}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Separator };\n"],"mappings":"AAYE;AAZF,SAAS,aAAa,0BAA0B;AAGhD,SAAS,UAAU;AAEnB,SAAS,UAAU;AAAA,EAClB;AAAA,EACA,cAAc;AAAA,EACd,aAAa;AAAA,EACb,GAAG;AACJ,GAAyD;AACxD,SACC;AAAA,IAAC,mBAAmB;AAAA,IAAnB;AAAA,MACA,WAAW;AAAA,QACV;AAAA,QACA;AAAA,MACD;AAAA,MACA,aAAU;AAAA,MACV;AAAA,MACA;AAAA,MACC,GAAG;AAAA;AAAA,EACL;AAEF;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/ui/separator.tsx"],"sourcesContent":["'use client';\n\nimport { Separator as SeparatorPrimitive } from 'radix-ui';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\n\nfunction Separator({\n\tclassName,\n\torientation = 'horizontal',\n\tdecorative = true,\n\t...props\n}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {\n\treturn (\n\t\t<SeparatorPrimitive.Root\n\t\t\tclassName={cn(\n\t\t\t\t'nt:shrink-0 nt:bg-border nt:data-horizontal:h-px nt:data-horizontal:w-full nt:data-vertical:w-px nt:data-vertical:self-stretch',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tdata-slot=\"separator\"\n\t\t\tdecorative={decorative}\n\t\t\torientation={orientation}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Separator };\n"],"mappings":";AAcE;AAZF,SAAS,aAAa,0BAA0B;AAGhD,SAAS,UAAU;AAEnB,SAAS,UAAU;AAAA,EAClB;AAAA,EACA,cAAc;AAAA,EACd,aAAa;AAAA,EACb,GAAG;AACJ,GAAyD;AACxD,SACC;AAAA,IAAC,mBAAmB;AAAA,IAAnB;AAAA,MACA,WAAW;AAAA,QACV;AAAA,QACA;AAAA,MACD;AAAA,MACA,aAAU;AAAA,MACV;AAAA,MACA;AAAA,MACC,GAAG;AAAA;AAAA,EACL;AAEF;","names":[]}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var textarea_exports = {};
20
+ __export(textarea_exports, {
21
+ Textarea: () => Textarea
22
+ });
23
+ module.exports = __toCommonJS(textarea_exports);
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ var import_utils = require("../../lib/utils");
26
+ function Textarea({ className, ...props }) {
27
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
28
+ "textarea",
29
+ {
30
+ className: (0, import_utils.cn)(
31
+ "nt:flex nt:field-sizing-content nt:min-h-16 nt:w-full nt:rounded-lg nt:border nt:border-input nt:bg-transparent nt:px-2.5 nt:py-2 nt:text-base nt:transition-colors nt:outline-none nt:placeholder:text-muted-foreground nt:focus-visible:border-ring nt:focus-visible:ring-3 nt:focus-visible:ring-ring/50 nt:disabled:cursor-not-allowed nt:disabled:bg-input/50 nt:disabled:opacity-50 nt:aria-invalid:border-destructive nt:aria-invalid:ring-3 nt:aria-invalid:ring-destructive/20 nt:md:text-sm nt:dark:bg-input/30 nt:dark:disabled:bg-input/80 nt:dark:aria-invalid:border-destructive/50 nt:dark:aria-invalid:ring-destructive/40",
32
+ className
33
+ ),
34
+ "data-slot": "textarea",
35
+ ...props
36
+ }
37
+ );
38
+ }
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ Textarea
42
+ });
43
+ //# sourceMappingURL=textarea.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/ui/textarea.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../../lib/utils';\n\nfunction Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {\n\treturn (\n\t\t<textarea\n\t\t\tclassName={cn(\n\t\t\t\t'nt:flex nt:field-sizing-content nt:min-h-16 nt:w-full nt:rounded-lg nt:border nt:border-input nt:bg-transparent nt:px-2.5 nt:py-2 nt:text-base nt:transition-colors nt:outline-none nt:placeholder:text-muted-foreground nt:focus-visible:border-ring nt:focus-visible:ring-3 nt:focus-visible:ring-ring/50 nt:disabled:cursor-not-allowed nt:disabled:bg-input/50 nt:disabled:opacity-50 nt:aria-invalid:border-destructive nt:aria-invalid:ring-3 nt:aria-invalid:ring-destructive/20 nt:md:text-sm nt:dark:bg-input/30 nt:dark:disabled:bg-input/80 nt:dark:aria-invalid:border-destructive/50 nt:dark:aria-invalid:ring-destructive/40',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tdata-slot=\"textarea\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Textarea };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAME;AAJF,mBAAmB;AAEnB,SAAS,SAAS,EAAE,WAAW,GAAG,MAAM,GAAqC;AAC5E,SACC;AAAA,IAAC;AAAA;AAAA,MACA,eAAW;AAAA,QACV;AAAA,QACA;AAAA,MACD;AAAA,MACA,aAAU;AAAA,MACT,GAAG;AAAA;AAAA,EACL;AAEF;","names":[]}
@@ -0,0 +1,6 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+
4
+ declare function Textarea({ className, ...props }: React.ComponentProps<'textarea'>): react_jsx_runtime.JSX.Element;
5
+
6
+ export { Textarea };
@@ -0,0 +1,6 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+
4
+ declare function Textarea({ className, ...props }: React.ComponentProps<'textarea'>): react_jsx_runtime.JSX.Element;
5
+
6
+ export { Textarea };
@@ -0,0 +1,19 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../lib/utils";
3
+ function Textarea({ className, ...props }) {
4
+ return /* @__PURE__ */ jsx(
5
+ "textarea",
6
+ {
7
+ className: cn(
8
+ "nt:flex nt:field-sizing-content nt:min-h-16 nt:w-full nt:rounded-lg nt:border nt:border-input nt:bg-transparent nt:px-2.5 nt:py-2 nt:text-base nt:transition-colors nt:outline-none nt:placeholder:text-muted-foreground nt:focus-visible:border-ring nt:focus-visible:ring-3 nt:focus-visible:ring-ring/50 nt:disabled:cursor-not-allowed nt:disabled:bg-input/50 nt:disabled:opacity-50 nt:aria-invalid:border-destructive nt:aria-invalid:ring-3 nt:aria-invalid:ring-destructive/20 nt:md:text-sm nt:dark:bg-input/30 nt:dark:disabled:bg-input/80 nt:dark:aria-invalid:border-destructive/50 nt:dark:aria-invalid:ring-destructive/40",
9
+ className
10
+ ),
11
+ "data-slot": "textarea",
12
+ ...props
13
+ }
14
+ );
15
+ }
16
+ export {
17
+ Textarea
18
+ };
19
+ //# sourceMappingURL=textarea.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/ui/textarea.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../../lib/utils';\n\nfunction Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {\n\treturn (\n\t\t<textarea\n\t\t\tclassName={cn(\n\t\t\t\t'nt:flex nt:field-sizing-content nt:min-h-16 nt:w-full nt:rounded-lg nt:border nt:border-input nt:bg-transparent nt:px-2.5 nt:py-2 nt:text-base nt:transition-colors nt:outline-none nt:placeholder:text-muted-foreground nt:focus-visible:border-ring nt:focus-visible:ring-3 nt:focus-visible:ring-ring/50 nt:disabled:cursor-not-allowed nt:disabled:bg-input/50 nt:disabled:opacity-50 nt:aria-invalid:border-destructive nt:aria-invalid:ring-3 nt:aria-invalid:ring-destructive/20 nt:md:text-sm nt:dark:bg-input/30 nt:dark:disabled:bg-input/80 nt:dark:aria-invalid:border-destructive/50 nt:dark:aria-invalid:ring-destructive/40',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tdata-slot=\"textarea\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Textarea };\n"],"mappings":"AAME;AAJF,SAAS,UAAU;AAEnB,SAAS,SAAS,EAAE,WAAW,GAAG,MAAM,GAAqC;AAC5E,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAW;AAAA,QACV;AAAA,QACA;AAAA,MACD;AAAA,MACA,aAAU;AAAA,MACT,GAAG;AAAA;AAAA,EACL;AAEF;","names":[]}
@@ -1,4 +1,4 @@
1
- import * as react from 'react';
1
+ import * as React$1 from 'react';
2
2
  import { UndoRedoAction } from './use-undo-redo.cjs';
3
3
  import { Editor } from '@tiptap/core';
4
4
  import 'lucide-react';
@@ -7,6 +7,6 @@ interface UndoRedoButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButton
7
7
  editor: Editor | null;
8
8
  action: UndoRedoAction;
9
9
  }
10
- declare const UndoRedoButton: react.ForwardRefExoticComponent<UndoRedoButtonProps & react.RefAttributes<HTMLButtonElement>>;
10
+ declare const UndoRedoButton: React$1.ForwardRefExoticComponent<UndoRedoButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
11
11
 
12
12
  export { UndoRedoButton, type UndoRedoButtonProps };
@@ -1,4 +1,4 @@
1
- import * as react from 'react';
1
+ import * as React$1 from 'react';
2
2
  import { UndoRedoAction } from './use-undo-redo.js';
3
3
  import { Editor } from '@tiptap/core';
4
4
  import 'lucide-react';
@@ -7,6 +7,6 @@ interface UndoRedoButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButton
7
7
  editor: Editor | null;
8
8
  action: UndoRedoAction;
9
9
  }
10
- declare const UndoRedoButton: react.ForwardRefExoticComponent<UndoRedoButtonProps & react.RefAttributes<HTMLButtonElement>>;
10
+ declare const UndoRedoButton: React$1.ForwardRefExoticComponent<UndoRedoButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
11
11
 
12
12
  export { UndoRedoButton, type UndoRedoButtonProps };
@@ -1,4 +1,4 @@
1
- import * as react from 'react';
1
+ import * as React from 'react';
2
2
  import * as lucide_react from 'lucide-react';
3
3
  import { Editor } from '@tiptap/core';
4
4
 
@@ -11,7 +11,7 @@ declare function useUndoRedo({ editor, action }: UseUndoRedoConfig): {
11
11
  canExecute: boolean;
12
12
  handleAction: () => boolean;
13
13
  label: string;
14
- Icon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
14
+ Icon: React.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
15
15
  };
16
16
 
17
17
  export { type UndoRedoAction, type UseUndoRedoConfig, useUndoRedo };
@@ -1,4 +1,4 @@
1
- import * as react from 'react';
1
+ import * as React from 'react';
2
2
  import * as lucide_react from 'lucide-react';
3
3
  import { Editor } from '@tiptap/core';
4
4
 
@@ -11,7 +11,7 @@ declare function useUndoRedo({ editor, action }: UseUndoRedoConfig): {
11
11
  canExecute: boolean;
12
12
  handleAction: () => boolean;
13
13
  label: string;
14
- Icon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
14
+ Icon: React.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
15
15
  };
16
16
 
17
17
  export { type UndoRedoAction, type UseUndoRedoConfig, useUndoRedo };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/extensions/code-block.ts"],"sourcesContent":["import { textblockTypeInputRule } from '@tiptap/core';\nimport { CodeBlockLowlight } from '@tiptap/extension-code-block-lowlight';\nimport { ReactNodeViewRenderer } from '@tiptap/react';\nimport { common, createLowlight } from 'lowlight';\n\nimport { CodeBlockView } from '../components/code-block-view/code-block-view';\nimport { normalizeLanguage } from '../lib/languages';\n\ntype Lowlight = ReturnType<typeof createLowlight>;\n\n// Module-level instance, shared by the default CodeBlockExtension and the\n// reader. Loads the lowlight `common` set (~37 mainstream languages, ~150 KB).\n// Consumers needing more or fewer languages should call createCodeBlockExtension\n// with their own instance and pass the same instance to <NotraReader lowlight={…} />.\nexport const defaultLowlight: Lowlight = createLowlight(common);\n\n// Mirrors the regexes in @tiptap/extension-code-block. Override the rules so\n// the captured language is collapsed to its canonical LANGUAGES value before\n// being written to the node attribute (e.g. ```js → language: \"javascript\").\nconst backtickInputRegex = /^```([a-z]+)?[\\s\\n]$/;\nconst tildeInputRegex = /^~~~([a-z]+)?[\\s\\n]$/;\n\nexport function createCodeBlockExtension(lowlight: Lowlight) {\n\treturn CodeBlockLowlight.configure({\n\t\tlowlight,\n\t\t// Tab inserts spaces instead of leaving the editor; Shift-Tab dedents.\n\t\tenableTabIndentation: true,\n\t\ttabSize: 2\n\t}).extend({\n\t\taddNodeView() {\n\t\t\treturn ReactNodeViewRenderer(CodeBlockView);\n\t\t},\n\t\taddKeyboardShortcuts() {\n\t\t\tconst parent = this.parent?.() ?? {};\n\n\t\t\t// Upstream's empty-selection Tab branch goes through\n\t\t\t// `editor.commands.insertContent(' '.repeat(tabSize))`, which\n\t\t\t// `tiptap-markdown` reroutes via its overridden `insertContentAt`\n\t\t\t// → `markdown.parser.parse(...)`. Whitespace-only input parses to\n\t\t\t// an empty document, so the spaces vanish while the keymap still\n\t\t\t// reports the event as handled. Use a raw transaction instead.\n\t\t\treturn {\n\t\t\t\t...parent,\n\t\t\t\tTab: ({ editor }) => {\n\t\t\t\t\tif (!this.options.enableTabIndentation) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst tabSize = this.options.tabSize ?? 2;\n\t\t\t\t\tconst { selection } = editor.state;\n\t\t\t\t\tconst { $from, empty } = selection;\n\n\t\t\t\t\tif ($from.parent.type !== this.type) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst indent = ' '.repeat(tabSize);\n\n\t\t\t\t\tif (empty) {\n\t\t\t\t\t\treturn editor.commands.command(({ tr }) => {\n\t\t\t\t\t\t\ttr.insertText(indent);\n\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\treturn editor.commands.command(({ tr, state }) => {\n\t\t\t\t\t\tconst { from, to } = selection;\n\t\t\t\t\t\tconst text = state.doc.textBetween(from, to, '\\n', '\\n');\n\t\t\t\t\t\tconst indented = text\n\t\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t\t.map((line) => indent + line)\n\t\t\t\t\t\t\t.join('\\n');\n\t\t\t\t\t\ttr.replaceWith(from, to, state.schema.text(indented));\n\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\taddInputRules() {\n\t\t\treturn [\n\t\t\t\ttextblockTypeInputRule({\n\t\t\t\t\tfind: backtickInputRegex,\n\t\t\t\t\ttype: this.type,\n\t\t\t\t\tgetAttributes: (match) => ({\n\t\t\t\t\t\tlanguage: normalizeLanguage(match[1])\n\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t\ttextblockTypeInputRule({\n\t\t\t\t\tfind: tildeInputRegex,\n\t\t\t\t\ttype: this.type,\n\t\t\t\t\tgetAttributes: (match) => ({\n\t\t\t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AACrB,kBAAM,OAAO,MAAM,IAAI,YAAY,MAAM,IAAI,MAAM,IAAI;AACvD,kBAAM,WAAW,KACf,MAAM,IAAI,EACV,IAAI,CAAC,SAAS,SAAS,IAAI,EAC3B,KAAK,IAAI;AACX,eAAG,YAAY,MAAM,IAAI,MAAM,OAAO,KAAK,QAAQ,CAAC;AAEpD,mBAAO;AAAA,UACR,CAAC;AAAA,QACF;AAAA,MACD;AAAA,IACD;AAAA,IACA,gBAAgB;AACf,aAAO;AAAA,YACN,oCAAuB;AAAA,UACtB,MAAM;AAAA,UACN,MAAM,KAAK;AAAA,UACX,eAAe,CAAC,WAAW;AAAA,YAC1B,cAAU,oCAAkB,MAAM,CAAC,CAAC;AAAA,UACrC;AAAA,QACD,CAAC;AAAA,YACD,oCAAuB;AAAA,UACtB,MAAM;AAAA,UACN,MAAM,KAAK;AAAA,UACX,eAAe,CAAC,WAAW;AAAA,YAC1B,cAAU,oCAAkB,MAAM,CAAC,CAAC;AAAA,UACrC;AAAA,QACD,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD,CAAC;AACF;AAEO,MAAM,qBAAqB,yBAAyB,eAAe;","names":[]}
1
+ {"version":3,"sources":["../../src/extensions/code-block.ts"],"sourcesContent":["import { textblockTypeInputRule } from '@tiptap/core';\nimport { CodeBlockLowlight } from '@tiptap/extension-code-block-lowlight';\nimport { ReactNodeViewRenderer } from '@tiptap/react';\nimport { common, createLowlight } from 'lowlight';\n\nimport { CodeBlockView } from '../components/code-block-view/code-block-view';\nimport { normalizeLanguage } from '../lib/languages';\n\ntype Lowlight = ReturnType<typeof createLowlight>;\n\n// Module-level instance, shared by the default CodeBlockExtension and the\n// reader. Loads the lowlight `common` set (~37 mainstream languages, ~150 KB).\n// Consumers needing more or fewer languages should call createCodeBlockExtension\n// with their own instance and pass the same instance to <NotraReader lowlight={…} />.\nexport const defaultLowlight: Lowlight = createLowlight(common);\n\n// Mirrors the regexes in @tiptap/extension-code-block. Override the rules so\n// the captured language is collapsed to its canonical LANGUAGES value before\n// being written to the node attribute (e.g. ```js → language: \"javascript\").\nconst backtickInputRegex = /^```([a-z]+)?[\\s\\n]$/;\nconst tildeInputRegex = /^~~~([a-z]+)?[\\s\\n]$/;\n\nexport function createCodeBlockExtension(lowlight: Lowlight) {\n\treturn CodeBlockLowlight.configure({\n\t\tlowlight,\n\t\t// Tab inserts spaces instead of leaving the editor; Shift-Tab dedents.\n\t\tenableTabIndentation: true,\n\t\ttabSize: 2\n\t}).extend({\n\t\taddNodeView() {\n\t\t\treturn ReactNodeViewRenderer(CodeBlockView);\n\t\t},\n\t\taddKeyboardShortcuts() {\n\t\t\tconst parent = this.parent?.() ?? {};\n\n\t\t\t// Upstream's empty-selection Tab branch goes through\n\t\t\t// `editor.commands.insertContent(' '.repeat(tabSize))`, which\n\t\t\t// `tiptap-markdown` reroutes via its overridden `insertContentAt`\n\t\t\t// → `markdown.parser.parse(...)`. Whitespace-only input parses to\n\t\t\t// an empty document, so the spaces vanish while the keymap still\n\t\t\t// reports the event as handled. Use a raw transaction instead.\n\t\t\treturn {\n\t\t\t\t...parent,\n\t\t\t\tTab: ({ editor }) => {\n\t\t\t\t\tif (!this.options.enableTabIndentation) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst tabSize = this.options.tabSize ?? 2;\n\t\t\t\t\tconst { selection } = editor.state;\n\t\t\t\t\tconst { $from, empty } = selection;\n\n\t\t\t\t\tif ($from.parent.type !== this.type) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst indent = ' '.repeat(tabSize);\n\n\t\t\t\t\tif (empty) {\n\t\t\t\t\t\treturn editor.commands.command(({ tr }) => {\n\t\t\t\t\t\t\ttr.insertText(indent);\n\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\treturn editor.commands.command(({ tr, state }) => {\n\t\t\t\t\t\tconst { from, to } = selection;\n\t\t\t\t\t\tconst text = state.doc.textBetween(from, to, '\\n', '\\n');\n\t\t\t\t\t\tconst indented = text\n\t\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t\t.map((line) => indent + line)\n\t\t\t\t\t\t\t.join('\\n');\n\n\t\t\t\t\t\ttr.replaceWith(from, to, state.schema.text(indented));\n\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\taddInputRules() {\n\t\t\treturn [\n\t\t\t\ttextblockTypeInputRule({\n\t\t\t\t\tfind: backtickInputRegex,\n\t\t\t\t\ttype: this.type,\n\t\t\t\t\tgetAttributes: (match) => ({\n\t\t\t\t\t\tlanguage: normalizeLanguage(match[1])\n\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t\ttextblockTypeInputRule({\n\t\t\t\t\tfind: tildeInputRegex,\n\t\t\t\t\ttype: this.type,\n\t\t\t\t\tgetAttributes: (match) => ({\n\t\t\t\t\t\tlanguage: normalizeLanguage(match[1])\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t];\n\t\t}\n\t});\n}\n\nexport const CodeBlockExtension = createCodeBlockExtension(defaultLowlight);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,2CAAkC;AAClC,mBAAsC;AACtC,sBAAuC;AAEvC,6BAA8B;AAC9B,uBAAkC;AAQ3B,MAAM,sBAA4B,gCAAe,sBAAM;AAK9D,MAAM,qBAAqB;AAC3B,MAAM,kBAAkB;AAEjB,SAAS,yBAAyB,UAAoB;AAC5D,SAAO,uDAAkB,UAAU;AAAA,IAClC;AAAA;AAAA,IAEA,sBAAsB;AAAA,IACtB,SAAS;AAAA,EACV,CAAC,EAAE,OAAO;AAAA,IACT,cAAc;AACb,iBAAO,oCAAsB,oCAAa;AAAA,IAC3C;AAAA,IACA,uBAAuB;AACtB,YAAM,SAAS,KAAK,SAAS,KAAK,CAAC;AAQnC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ACF;AAAA,IACD;AAAA,EACD,CAAC;AACF;AAEO,MAAM,qBAAqB,yBAAyB,eAAe;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/extensions/code-block.ts"],"sourcesContent":["import { textblockTypeInputRule } from '@tiptap/core';\nimport { CodeBlockLowlight } from '@tiptap/extension-code-block-lowlight';\nimport { ReactNodeViewRenderer } from '@tiptap/react';\nimport { common, createLowlight } from 'lowlight';\n\nimport { CodeBlockView } from '../components/code-block-view/code-block-view';\nimport { normalizeLanguage } from '../lib/languages';\n\ntype Lowlight = ReturnType<typeof createLowlight>;\n\n// Module-level instance, shared by the default CodeBlockExtension and the\n// reader. Loads the lowlight `common` set (~37 mainstream languages, ~150 KB).\n// Consumers needing more or fewer languages should call createCodeBlockExtension\n// with their own instance and pass the same instance to <NotraReader lowlight={…} />.\nexport const defaultLowlight: Lowlight = createLowlight(common);\n\n// Mirrors the regexes in @tiptap/extension-code-block. Override the rules so\n// the captured language is collapsed to its canonical LANGUAGES value before\n// being written to the node attribute (e.g. ```js → language: \"javascript\").\nconst backtickInputRegex = /^```([a-z]+)?[\\s\\n]$/;\nconst tildeInputRegex = /^~~~([a-z]+)?[\\s\\n]$/;\n\nexport function createCodeBlockExtension(lowlight: Lowlight) {\n\treturn CodeBlockLowlight.configure({\n\t\tlowlight,\n\t\t// Tab inserts spaces instead of leaving the editor; Shift-Tab dedents.\n\t\tenableTabIndentation: true,\n\t\ttabSize: 2\n\t}).extend({\n\t\taddNodeView() {\n\t\t\treturn ReactNodeViewRenderer(CodeBlockView);\n\t\t},\n\t\taddKeyboardShortcuts() {\n\t\t\tconst parent = this.parent?.() ?? {};\n\n\t\t\t// Upstream's empty-selection Tab branch goes through\n\t\t\t// `editor.commands.insertContent(' '.repeat(tabSize))`, which\n\t\t\t// `tiptap-markdown` reroutes via its overridden `insertContentAt`\n\t\t\t// → `markdown.parser.parse(...)`. Whitespace-only input parses to\n\t\t\t// an empty document, so the spaces vanish while the keymap still\n\t\t\t// reports the event as handled. Use a raw transaction instead.\n\t\t\treturn {\n\t\t\t\t...parent,\n\t\t\t\tTab: ({ editor }) => {\n\t\t\t\t\tif (!this.options.enableTabIndentation) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst tabSize = this.options.tabSize ?? 2;\n\t\t\t\t\tconst { selection } = editor.state;\n\t\t\t\t\tconst { $from, empty } = selection;\n\n\t\t\t\t\tif ($from.parent.type !== this.type) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst indent = ' '.repeat(tabSize);\n\n\t\t\t\t\tif (empty) {\n\t\t\t\t\t\treturn editor.commands.command(({ tr }) => {\n\t\t\t\t\t\t\ttr.insertText(indent);\n\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\treturn editor.commands.command(({ tr, state }) => {\n\t\t\t\t\t\tconst { from, to } = selection;\n\t\t\t\t\t\tconst text = state.doc.textBetween(from, to, '\\n', '\\n');\n\t\t\t\t\t\tconst indented = text\n\t\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t\t.map((line) => indent + line)\n\t\t\t\t\t\t\t.join('\\n');\n\t\t\t\t\t\ttr.replaceWith(from, to, state.schema.text(indented));\n\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\taddInputRules() {\n\t\t\treturn [\n\t\t\t\ttextblockTypeInputRule({\n\t\t\t\t\tfind: backtickInputRegex,\n\t\t\t\t\ttype: this.type,\n\t\t\t\t\tgetAttributes: (match) => ({\n\t\t\t\t\t\tlanguage: normalizeLanguage(match[1])\n\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t\ttextblockTypeInputRule({\n\t\t\t\t\tfind: tildeInputRegex,\n\t\t\t\t\ttype: this.type,\n\t\t\t\t\tgetAttributes: (match) => ({\n\t\t\t\t\t\tlanguage: normalizeLanguage(match[1])\n\t\t\t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ACvD,kBAAM,WAAW,KACf,MAAM,IAAI,EACV,IAAI,CAAC,SAAS,SAAS,IAAI,EAC3B,KAAK,IAAI;AACX,eAAG,YAAY,MAAM,IAAI,MAAM,OAAO,KAAK,QAAQ,CAAC;AAEpD,mBAAO;AAAA,UACR,CAAC;AAAA,QACF;AAAA,MACD;AAAA,IACD;AAAA,IACA,gBAAgB;AACf,aAAO;AAAA,QACN,uBAAuB;AAAA,UACtB,MAAM;AAAA,UACN,MAAM,KAAK;AAAA,UACX,eAAe,CAAC,WAAW;AAAA,YAC1B,UAAU,kBAAkB,MAAM,CAAC,CAAC;AAAA,UACrC;AAAA,QACD,CAAC;AAAA,QACD,uBAAuB;AAAA,UACtB,MAAM;AAAA,UACN,MAAM,KAAK;AAAA,UACX,eAAe,CAAC,WAAW;AAAA,YAC1B,UAAU,kBAAkB,MAAM,CAAC,CAAC;AAAA,UACrC;AAAA,QACD,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD,CAAC;AACF;AAEO,MAAM,qBAAqB,yBAAyB,eAAe;","names":[]}
1
+ {"version":3,"sources":["../../src/extensions/code-block.ts"],"sourcesContent":["import { textblockTypeInputRule } from '@tiptap/core';\nimport { CodeBlockLowlight } from '@tiptap/extension-code-block-lowlight';\nimport { ReactNodeViewRenderer } from '@tiptap/react';\nimport { common, createLowlight } from 'lowlight';\n\nimport { CodeBlockView } from '../components/code-block-view/code-block-view';\nimport { normalizeLanguage } from '../lib/languages';\n\ntype Lowlight = ReturnType<typeof createLowlight>;\n\n// Module-level instance, shared by the default CodeBlockExtension and the\n// reader. Loads the lowlight `common` set (~37 mainstream languages, ~150 KB).\n// Consumers needing more or fewer languages should call createCodeBlockExtension\n// with their own instance and pass the same instance to <NotraReader lowlight={…} />.\nexport const defaultLowlight: Lowlight = createLowlight(common);\n\n// Mirrors the regexes in @tiptap/extension-code-block. Override the rules so\n// the captured language is collapsed to its canonical LANGUAGES value before\n// being written to the node attribute (e.g. ```js → language: \"javascript\").\nconst backtickInputRegex = /^```([a-z]+)?[\\s\\n]$/;\nconst tildeInputRegex = /^~~~([a-z]+)?[\\s\\n]$/;\n\nexport function createCodeBlockExtension(lowlight: Lowlight) {\n\treturn CodeBlockLowlight.configure({\n\t\tlowlight,\n\t\t// Tab inserts spaces instead of leaving the editor; Shift-Tab dedents.\n\t\tenableTabIndentation: true,\n\t\ttabSize: 2\n\t}).extend({\n\t\taddNodeView() {\n\t\t\treturn ReactNodeViewRenderer(CodeBlockView);\n\t\t},\n\t\taddKeyboardShortcuts() {\n\t\t\tconst parent = this.parent?.() ?? {};\n\n\t\t\t// Upstream's empty-selection Tab branch goes through\n\t\t\t// `editor.commands.insertContent(' '.repeat(tabSize))`, which\n\t\t\t// `tiptap-markdown` reroutes via its overridden `insertContentAt`\n\t\t\t// → `markdown.parser.parse(...)`. Whitespace-only input parses to\n\t\t\t// an empty document, so the spaces vanish while the keymap still\n\t\t\t// reports the event as handled. Use a raw transaction instead.\n\t\t\treturn {\n\t\t\t\t...parent,\n\t\t\t\tTab: ({ editor }) => {\n\t\t\t\t\tif (!this.options.enableTabIndentation) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst tabSize = this.options.tabSize ?? 2;\n\t\t\t\t\tconst { selection } = editor.state;\n\t\t\t\t\tconst { $from, empty } = selection;\n\n\t\t\t\t\tif ($from.parent.type !== this.type) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst indent = ' '.repeat(tabSize);\n\n\t\t\t\t\tif (empty) {\n\t\t\t\t\t\treturn editor.commands.command(({ tr }) => {\n\t\t\t\t\t\t\ttr.insertText(indent);\n\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\treturn editor.commands.command(({ tr, state }) => {\n\t\t\t\t\t\tconst { from, to } = selection;\n\t\t\t\t\t\tconst text = state.doc.textBetween(from, to, '\\n', '\\n');\n\t\t\t\t\t\tconst indented = text\n\t\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t\t.map((line) => indent + line)\n\t\t\t\t\t\t\t.join('\\n');\n\n\t\t\t\t\t\ttr.replaceWith(from, to, state.schema.text(indented));\n\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\taddInputRules() {\n\t\t\treturn [\n\t\t\t\ttextblockTypeInputRule({\n\t\t\t\t\tfind: backtickInputRegex,\n\t\t\t\t\ttype: this.type,\n\t\t\t\t\tgetAttributes: (match) => ({\n\t\t\t\t\t\tlanguage: normalizeLanguage(match[1])\n\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t\ttextblockTypeInputRule({\n\t\t\t\t\tfind: tildeInputRegex,\n\t\t\t\t\ttype: this.type,\n\t\t\t\t\tgetAttributes: (match) => ({\n\t\t\t\t\t\tlanguage: normalizeLanguage(match[1])\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t];\n\t\t}\n\t});\n}\n\nexport const CodeBlockExtension = createCodeBlockExtension(defaultLowlight);\n"],"mappings":"AAAA,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AAClC,SAAS,6BAA6B;AACtC,SAAS,QAAQ,sBAAsB;AAEvC,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAQ3B,MAAM,kBAA4B,eAAe,MAAM;AAK9D,MAAM,qBAAqB;AAC3B,MAAM,kBAAkB;AAEjB,SAAS,yBAAyB,UAAoB;AAC5D,SAAO,kBAAkB,UAAU;AAAA,IAClC;AAAA;AAAA,IAEA,sBAAsB;AAAA,IACtB,SAAS;AAAA,EACV,CAAC,EAAE,OAAO;AAAA,IACT,cAAc;AACb,aAAO,sBAAsB,aAAa;AAAA,IAC3C;AAAA,IACA,uBAAuB;AACtB,YAAM,SAAS,KAAK,SAAS,KAAK,CAAC;AAQnC,aAAO;AAAA,QACN,GAAG;AAAA,QACH,KAAK,CAAC,EAAE,OAAO,MAAM;AACpB,cAAI,CAAC,KAA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