notra-editor 0.4.0 → 0.6.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.
- package/dist/components/code-block-view/code-block-shell.cjs +41 -0
- package/dist/components/code-block-view/code-block-shell.cjs.map +1 -0
- package/dist/components/code-block-view/code-block-shell.d.cts +11 -0
- package/dist/components/code-block-view/code-block-shell.d.ts +11 -0
- package/dist/components/code-block-view/code-block-shell.mjs +17 -0
- package/dist/components/code-block-view/code-block-shell.mjs.map +1 -0
- package/dist/components/{code-block-view.cjs → code-block-view/code-block-view.cjs} +16 -8
- package/dist/components/code-block-view/code-block-view.cjs.map +1 -0
- package/dist/components/code-block-view/code-block-view.d.cts +6 -0
- package/dist/components/code-block-view/code-block-view.d.ts +6 -0
- package/dist/components/code-block-view/code-block-view.mjs +26 -0
- package/dist/components/code-block-view/code-block-view.mjs.map +1 -0
- package/dist/components/code-block-view/language-select.cjs +91 -0
- package/dist/components/code-block-view/language-select.cjs.map +1 -0
- package/dist/components/code-block-view/language-select.d.cts +11 -0
- package/dist/components/code-block-view/language-select.d.ts +11 -0
- package/dist/components/code-block-view/language-select.mjs +74 -0
- package/dist/components/code-block-view/language-select.mjs.map +1 -0
- package/dist/components/image-popover/image-popover.cjs +161 -0
- package/dist/components/image-popover/image-popover.cjs.map +1 -0
- package/dist/components/image-popover/image-popover.d.cts +9 -0
- package/dist/components/image-popover/image-popover.d.ts +9 -0
- package/dist/components/image-popover/image-popover.mjs +137 -0
- package/dist/components/image-popover/image-popover.mjs.map +1 -0
- package/dist/components/image-popover/use-image-popover.cjs +88 -0
- package/dist/components/image-popover/use-image-popover.cjs.map +1 -0
- package/dist/components/image-popover/use-image-popover.d.cts +19 -0
- package/dist/components/image-popover/use-image-popover.d.ts +19 -0
- package/dist/components/image-popover/use-image-popover.mjs +64 -0
- package/dist/components/image-popover/use-image-popover.mjs.map +1 -0
- package/dist/components/link-popover/link-popover.cjs +12 -3
- package/dist/components/link-popover/link-popover.cjs.map +1 -1
- package/dist/components/link-popover/link-popover.mjs +12 -3
- package/dist/components/link-popover/link-popover.mjs.map +1 -1
- package/dist/components/link-popover/use-link-popover.cjs +17 -2
- package/dist/components/link-popover/use-link-popover.cjs.map +1 -1
- package/dist/components/link-popover/use-link-popover.d.cts +1 -0
- package/dist/components/link-popover/use-link-popover.d.ts +1 -0
- package/dist/components/link-popover/use-link-popover.mjs +17 -2
- package/dist/components/link-popover/use-link-popover.mjs.map +1 -1
- package/dist/components/ui/command.cjs +144 -0
- package/dist/components/ui/command.cjs.map +1 -0
- package/dist/components/ui/command.d.cts +12 -0
- package/dist/components/ui/command.d.ts +12 -0
- package/dist/components/ui/command.mjs +115 -0
- package/dist/components/ui/command.mjs.map +1 -0
- package/dist/extensions/code-block.cjs +76 -19
- package/dist/extensions/code-block.cjs.map +1 -1
- package/dist/extensions/code-block.d.cts +7 -3
- package/dist/extensions/code-block.d.ts +7 -3
- package/dist/extensions/code-block.mjs +73 -8
- package/dist/extensions/code-block.mjs.map +1 -1
- package/dist/extensions/editor.cjs +2 -0
- package/dist/extensions/editor.cjs.map +1 -1
- package/dist/extensions/editor.d.cts +4 -3
- package/dist/extensions/editor.d.ts +4 -3
- package/dist/extensions/editor.mjs +2 -0
- package/dist/extensions/editor.mjs.map +1 -1
- package/dist/extensions/index.d.cts +2 -1
- package/dist/extensions/index.d.ts +2 -1
- package/dist/extensions/shared.cjs +8 -2
- package/dist/extensions/shared.cjs.map +1 -1
- package/dist/extensions/shared.d.cts +3 -1
- package/dist/extensions/shared.d.ts +3 -1
- package/dist/extensions/shared.mjs +8 -2
- package/dist/extensions/shared.mjs.map +1 -1
- package/dist/index.cjs +23 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.mjs +18 -1
- package/dist/index.mjs.map +1 -1
- package/dist/lib/highlight-code-to-html.cjs +38 -0
- package/dist/lib/highlight-code-to-html.cjs.map +1 -0
- package/dist/lib/highlight-code-to-html.d.cts +6 -0
- package/dist/lib/highlight-code-to-html.d.ts +6 -0
- package/dist/lib/highlight-code-to-html.mjs +14 -0
- package/dist/lib/highlight-code-to-html.mjs.map +1 -0
- package/dist/lib/languages.cjs +181 -0
- package/dist/lib/languages.cjs.map +1 -0
- package/dist/lib/languages.d.cts +24 -0
- package/dist/lib/languages.d.ts +24 -0
- package/dist/lib/languages.mjs +155 -0
- package/dist/lib/languages.mjs.map +1 -0
- package/dist/notra-editor.cjs +3 -1
- package/dist/notra-editor.cjs.map +1 -1
- package/dist/notra-editor.mjs +3 -1
- package/dist/notra-editor.mjs.map +1 -1
- package/dist/notra-reader.cjs +32 -3
- package/dist/notra-reader.cjs.map +1 -1
- package/dist/notra-reader.d.cts +11 -1
- package/dist/notra-reader.d.ts +11 -1
- package/dist/notra-reader.mjs +32 -3
- package/dist/notra-reader.mjs.map +1 -1
- package/dist/styles/globals.css +112 -0
- package/dist/themes/default/shared.css +150 -5
- package/package.json +6 -1
- package/dist/components/code-block-view.cjs.map +0 -1
- package/dist/components/code-block-view.d.cts +0 -12
- package/dist/components/code-block-view.d.ts +0 -12
- package/dist/components/code-block-view.mjs +0 -17
- package/dist/components/code-block-view.mjs.map +0 -1
|
@@ -0,0 +1,144 @@
|
|
|
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 command_exports = {};
|
|
20
|
+
__export(command_exports, {
|
|
21
|
+
Command: () => Command,
|
|
22
|
+
CommandEmpty: () => CommandEmpty,
|
|
23
|
+
CommandGroup: () => CommandGroup,
|
|
24
|
+
CommandInput: () => CommandInput,
|
|
25
|
+
CommandItem: () => CommandItem,
|
|
26
|
+
CommandList: () => CommandList
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(command_exports);
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
var import_cmdk = require("cmdk");
|
|
31
|
+
var import_lucide_react = require("lucide-react");
|
|
32
|
+
var import_utils = require("../../lib/utils");
|
|
33
|
+
function Command({
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
}) {
|
|
37
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
38
|
+
import_cmdk.Command,
|
|
39
|
+
{
|
|
40
|
+
className: (0, import_utils.cn)(
|
|
41
|
+
"nt:flex nt:h-full nt:w-full nt:flex-col nt:overflow-hidden nt:rounded-lg nt:bg-popover nt:text-popover-foreground",
|
|
42
|
+
className
|
|
43
|
+
),
|
|
44
|
+
"data-slot": "command",
|
|
45
|
+
...props
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
function CommandInput({
|
|
50
|
+
className,
|
|
51
|
+
...props
|
|
52
|
+
}) {
|
|
53
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
className: "nt:flex nt:items-center nt:gap-2 nt:border-b nt:border-foreground/10 nt:px-3",
|
|
57
|
+
"data-slot": "command-input-wrapper",
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.SearchIcon, { className: "nt:size-4 nt:shrink-0 nt:opacity-50" }),
|
|
60
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
61
|
+
import_cmdk.Command.Input,
|
|
62
|
+
{
|
|
63
|
+
className: (0, import_utils.cn)(
|
|
64
|
+
"nt:flex nt:h-9 nt:w-full nt:rounded-md nt:bg-transparent nt:py-3 nt:text-sm nt:outline-hidden nt:placeholder:text-muted-foreground nt:disabled:cursor-not-allowed nt:disabled:opacity-50",
|
|
65
|
+
className
|
|
66
|
+
),
|
|
67
|
+
"data-slot": "command-input",
|
|
68
|
+
...props
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
function CommandList({
|
|
76
|
+
className,
|
|
77
|
+
...props
|
|
78
|
+
}) {
|
|
79
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
80
|
+
import_cmdk.Command.List,
|
|
81
|
+
{
|
|
82
|
+
className: (0, import_utils.cn)(
|
|
83
|
+
"nt:max-h-[300px] nt:scroll-py-1 nt:overflow-x-hidden nt:overflow-y-auto",
|
|
84
|
+
className
|
|
85
|
+
),
|
|
86
|
+
"data-slot": "command-list",
|
|
87
|
+
...props
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
function CommandEmpty({
|
|
92
|
+
...props
|
|
93
|
+
}) {
|
|
94
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
95
|
+
import_cmdk.Command.Empty,
|
|
96
|
+
{
|
|
97
|
+
className: "nt:py-6 nt:text-center nt:text-sm",
|
|
98
|
+
"data-slot": "command-empty",
|
|
99
|
+
...props
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
function CommandGroup({
|
|
104
|
+
className,
|
|
105
|
+
...props
|
|
106
|
+
}) {
|
|
107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
108
|
+
import_cmdk.Command.Group,
|
|
109
|
+
{
|
|
110
|
+
className: (0, import_utils.cn)(
|
|
111
|
+
"nt:overflow-hidden nt:p-1 nt:text-foreground nt:[&_[cmdk-group-heading]]:px-2 nt:[&_[cmdk-group-heading]]:py-1.5 nt:[&_[cmdk-group-heading]]:text-xs nt:[&_[cmdk-group-heading]]:font-medium nt:[&_[cmdk-group-heading]]:text-muted-foreground",
|
|
112
|
+
className
|
|
113
|
+
),
|
|
114
|
+
"data-slot": "command-group",
|
|
115
|
+
...props
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
function CommandItem({
|
|
120
|
+
className,
|
|
121
|
+
...props
|
|
122
|
+
}) {
|
|
123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
124
|
+
import_cmdk.Command.Item,
|
|
125
|
+
{
|
|
126
|
+
className: (0, import_utils.cn)(
|
|
127
|
+
"nt:relative nt:flex nt:cursor-default nt:items-center nt:gap-2 nt:rounded-md nt:px-2 nt:py-1.5 nt:text-sm nt:outline-hidden nt:select-none nt:data-[selected=true]:bg-accent nt:data-[selected=true]:text-accent-foreground nt:data-[disabled=true]:pointer-events-none nt:data-[disabled=true]:opacity-50",
|
|
128
|
+
className
|
|
129
|
+
),
|
|
130
|
+
"data-slot": "command-item",
|
|
131
|
+
...props
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
136
|
+
0 && (module.exports = {
|
|
137
|
+
Command,
|
|
138
|
+
CommandEmpty,
|
|
139
|
+
CommandGroup,
|
|
140
|
+
CommandInput,
|
|
141
|
+
CommandItem,
|
|
142
|
+
CommandList
|
|
143
|
+
});
|
|
144
|
+
//# sourceMappingURL=command.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/command.tsx"],"sourcesContent":["import { Command as CommandPrimitive } from 'cmdk';\nimport { SearchIcon } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\n\nfunction Command({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive>) {\n\treturn (\n\t\t<CommandPrimitive\n\t\t\tclassName={cn(\n\t\t\t\t'nt:flex nt:h-full nt:w-full nt:flex-col nt:overflow-hidden nt:rounded-lg nt:bg-popover nt:text-popover-foreground',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tdata-slot=\"command\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction CommandInput({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n\treturn (\n\t\t<div\n\t\t\tclassName=\"nt:flex nt:items-center nt:gap-2 nt:border-b nt:border-foreground/10 nt:px-3\"\n\t\t\tdata-slot=\"command-input-wrapper\"\n\t\t>\n\t\t\t<SearchIcon className=\"nt:size-4 nt:shrink-0 nt:opacity-50\" />\n\t\t\t<CommandPrimitive.Input\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'nt:flex nt:h-9 nt:w-full nt:rounded-md nt:bg-transparent nt:py-3 nt:text-sm nt:outline-hidden nt:placeholder:text-muted-foreground nt:disabled:cursor-not-allowed nt:disabled:opacity-50',\n\t\t\t\t\tclassName\n\t\t\t\t)}\n\t\t\t\tdata-slot=\"command-input\"\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction CommandList({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive.List>) {\n\treturn (\n\t\t<CommandPrimitive.List\n\t\t\tclassName={cn(\n\t\t\t\t'nt:max-h-[300px] nt:scroll-py-1 nt:overflow-x-hidden nt:overflow-y-auto',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tdata-slot=\"command-list\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction CommandEmpty({\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n\treturn (\n\t\t<CommandPrimitive.Empty\n\t\t\tclassName=\"nt:py-6 nt:text-center nt:text-sm\"\n\t\t\tdata-slot=\"command-empty\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction CommandGroup({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n\treturn (\n\t\t<CommandPrimitive.Group\n\t\t\tclassName={cn(\n\t\t\t\t'nt:overflow-hidden nt:p-1 nt:text-foreground nt:[&_[cmdk-group-heading]]:px-2 nt:[&_[cmdk-group-heading]]:py-1.5 nt:[&_[cmdk-group-heading]]:text-xs nt:[&_[cmdk-group-heading]]:font-medium nt:[&_[cmdk-group-heading]]:text-muted-foreground',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tdata-slot=\"command-group\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction CommandItem({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive.Item>) {\n\treturn (\n\t\t<CommandPrimitive.Item\n\t\t\tclassName={cn(\n\t\t\t\t'nt:relative nt:flex nt:cursor-default nt:items-center nt:gap-2 nt:rounded-md nt:px-2 nt:py-1.5 nt:text-sm nt:outline-hidden nt:select-none nt:data-[selected=true]:bg-accent nt:data-[selected=true]:text-accent-foreground nt:data-[disabled=true]:pointer-events-none nt:data-[disabled=true]:opacity-50',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tdata-slot=\"command-item\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tCommand,\n\tCommandEmpty,\n\tCommandGroup,\n\tCommandInput,\n\tCommandItem,\n\tCommandList\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWE;AAXF,kBAA4C;AAC5C,0BAA2B;AAG3B,mBAAmB;AAEnB,SAAS,QAAQ;AAAA,EAChB;AAAA,EACA,GAAG;AACJ,GAAkD;AACjD,SACC;AAAA,IAAC,YAAAA;AAAA,IAAA;AAAA,MACA,eAAW;AAAA,QACV;AAAA,QACA;AAAA,MACD;AAAA,MACA,aAAU;AAAA,MACT,GAAG;AAAA;AAAA,EACL;AAEF;AAEA,SAAS,aAAa;AAAA,EACrB;AAAA,EACA,GAAG;AACJ,GAAwD;AACvD,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,aAAU;AAAA,MAEV;AAAA,oDAAC,kCAAW,WAAU,uCAAsC;AAAA,QAC5D;AAAA,UAAC,YAAAA,QAAiB;AAAA,UAAjB;AAAA,YACA,eAAW;AAAA,cACV;AAAA,cACA;AAAA,YACD;AAAA,YACA,aAAU;AAAA,YACT,GAAG;AAAA;AAAA,QACL;AAAA;AAAA;AAAA,EACD;AAEF;AAEA,SAAS,YAAY;AAAA,EACpB;AAAA,EACA,GAAG;AACJ,GAAuD;AACtD,SACC;AAAA,IAAC,YAAAA,QAAiB;AAAA,IAAjB;AAAA,MACA,eAAW;AAAA,QACV;AAAA,QACA;AAAA,MACD;AAAA,MACA,aAAU;AAAA,MACT,GAAG;AAAA;AAAA,EACL;AAEF;AAEA,SAAS,aAAa;AAAA,EACrB,GAAG;AACJ,GAAwD;AACvD,SACC;AAAA,IAAC,YAAAA,QAAiB;AAAA,IAAjB;AAAA,MACA,WAAU;AAAA,MACV,aAAU;AAAA,MACT,GAAG;AAAA;AAAA,EACL;AAEF;AAEA,SAAS,aAAa;AAAA,EACrB;AAAA,EACA,GAAG;AACJ,GAAwD;AACvD,SACC;AAAA,IAAC,YAAAA,QAAiB;AAAA,IAAjB;AAAA,MACA,eAAW;AAAA,QACV;AAAA,QACA;AAAA,MACD;AAAA,MACA,aAAU;AAAA,MACT,GAAG;AAAA;AAAA,EACL;AAEF;AAEA,SAAS,YAAY;AAAA,EACpB;AAAA,EACA,GAAG;AACJ,GAAuD;AACtD,SACC;AAAA,IAAC,YAAAA,QAAiB;AAAA,IAAjB;AAAA,MACA,eAAW;AAAA,QACV;AAAA,QACA;AAAA,MACD;AAAA,MACA,aAAU;AAAA,MACT,GAAG;AAAA;AAAA,EACL;AAEF;","names":["CommandPrimitive"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Command as Command$1 } from 'cmdk';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
|
|
5
|
+
declare function Command({ className, ...props }: react.ComponentProps<typeof Command$1>): react_jsx_runtime.JSX.Element;
|
|
6
|
+
declare function CommandInput({ className, ...props }: react.ComponentProps<typeof Command$1.Input>): react_jsx_runtime.JSX.Element;
|
|
7
|
+
declare function CommandList({ className, ...props }: react.ComponentProps<typeof Command$1.List>): react_jsx_runtime.JSX.Element;
|
|
8
|
+
declare function CommandEmpty({ ...props }: react.ComponentProps<typeof Command$1.Empty>): react_jsx_runtime.JSX.Element;
|
|
9
|
+
declare function CommandGroup({ className, ...props }: react.ComponentProps<typeof Command$1.Group>): react_jsx_runtime.JSX.Element;
|
|
10
|
+
declare function CommandItem({ className, ...props }: react.ComponentProps<typeof Command$1.Item>): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Command as Command$1 } from 'cmdk';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
|
|
5
|
+
declare function Command({ className, ...props }: react.ComponentProps<typeof Command$1>): react_jsx_runtime.JSX.Element;
|
|
6
|
+
declare function CommandInput({ className, ...props }: react.ComponentProps<typeof Command$1.Input>): react_jsx_runtime.JSX.Element;
|
|
7
|
+
declare function CommandList({ className, ...props }: react.ComponentProps<typeof Command$1.List>): react_jsx_runtime.JSX.Element;
|
|
8
|
+
declare function CommandEmpty({ ...props }: react.ComponentProps<typeof Command$1.Empty>): react_jsx_runtime.JSX.Element;
|
|
9
|
+
declare function CommandGroup({ className, ...props }: react.ComponentProps<typeof Command$1.Group>): react_jsx_runtime.JSX.Element;
|
|
10
|
+
declare function CommandItem({ className, ...props }: react.ComponentProps<typeof Command$1.Item>): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
3
|
+
import { SearchIcon } from "lucide-react";
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
function Command({
|
|
6
|
+
className,
|
|
7
|
+
...props
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
CommandPrimitive,
|
|
11
|
+
{
|
|
12
|
+
className: cn(
|
|
13
|
+
"nt:flex nt:h-full nt:w-full nt:flex-col nt:overflow-hidden nt:rounded-lg nt:bg-popover nt:text-popover-foreground",
|
|
14
|
+
className
|
|
15
|
+
),
|
|
16
|
+
"data-slot": "command",
|
|
17
|
+
...props
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
function CommandInput({
|
|
22
|
+
className,
|
|
23
|
+
...props
|
|
24
|
+
}) {
|
|
25
|
+
return /* @__PURE__ */ jsxs(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
className: "nt:flex nt:items-center nt:gap-2 nt:border-b nt:border-foreground/10 nt:px-3",
|
|
29
|
+
"data-slot": "command-input-wrapper",
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsx(SearchIcon, { className: "nt:size-4 nt:shrink-0 nt:opacity-50" }),
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
CommandPrimitive.Input,
|
|
34
|
+
{
|
|
35
|
+
className: cn(
|
|
36
|
+
"nt:flex nt:h-9 nt:w-full nt:rounded-md nt:bg-transparent nt:py-3 nt:text-sm nt:outline-hidden nt:placeholder:text-muted-foreground nt:disabled:cursor-not-allowed nt:disabled:opacity-50",
|
|
37
|
+
className
|
|
38
|
+
),
|
|
39
|
+
"data-slot": "command-input",
|
|
40
|
+
...props
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function CommandList({
|
|
48
|
+
className,
|
|
49
|
+
...props
|
|
50
|
+
}) {
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
CommandPrimitive.List,
|
|
53
|
+
{
|
|
54
|
+
className: cn(
|
|
55
|
+
"nt:max-h-[300px] nt:scroll-py-1 nt:overflow-x-hidden nt:overflow-y-auto",
|
|
56
|
+
className
|
|
57
|
+
),
|
|
58
|
+
"data-slot": "command-list",
|
|
59
|
+
...props
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
function CommandEmpty({
|
|
64
|
+
...props
|
|
65
|
+
}) {
|
|
66
|
+
return /* @__PURE__ */ jsx(
|
|
67
|
+
CommandPrimitive.Empty,
|
|
68
|
+
{
|
|
69
|
+
className: "nt:py-6 nt:text-center nt:text-sm",
|
|
70
|
+
"data-slot": "command-empty",
|
|
71
|
+
...props
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
function CommandGroup({
|
|
76
|
+
className,
|
|
77
|
+
...props
|
|
78
|
+
}) {
|
|
79
|
+
return /* @__PURE__ */ jsx(
|
|
80
|
+
CommandPrimitive.Group,
|
|
81
|
+
{
|
|
82
|
+
className: cn(
|
|
83
|
+
"nt:overflow-hidden nt:p-1 nt:text-foreground nt:[&_[cmdk-group-heading]]:px-2 nt:[&_[cmdk-group-heading]]:py-1.5 nt:[&_[cmdk-group-heading]]:text-xs nt:[&_[cmdk-group-heading]]:font-medium nt:[&_[cmdk-group-heading]]:text-muted-foreground",
|
|
84
|
+
className
|
|
85
|
+
),
|
|
86
|
+
"data-slot": "command-group",
|
|
87
|
+
...props
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
function CommandItem({
|
|
92
|
+
className,
|
|
93
|
+
...props
|
|
94
|
+
}) {
|
|
95
|
+
return /* @__PURE__ */ jsx(
|
|
96
|
+
CommandPrimitive.Item,
|
|
97
|
+
{
|
|
98
|
+
className: cn(
|
|
99
|
+
"nt:relative nt:flex nt:cursor-default nt:items-center nt:gap-2 nt:rounded-md nt:px-2 nt:py-1.5 nt:text-sm nt:outline-hidden nt:select-none nt:data-[selected=true]:bg-accent nt:data-[selected=true]:text-accent-foreground nt:data-[disabled=true]:pointer-events-none nt:data-[disabled=true]:opacity-50",
|
|
100
|
+
className
|
|
101
|
+
),
|
|
102
|
+
"data-slot": "command-item",
|
|
103
|
+
...props
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
export {
|
|
108
|
+
Command,
|
|
109
|
+
CommandEmpty,
|
|
110
|
+
CommandGroup,
|
|
111
|
+
CommandInput,
|
|
112
|
+
CommandItem,
|
|
113
|
+
CommandList
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=command.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/command.tsx"],"sourcesContent":["import { Command as CommandPrimitive } from 'cmdk';\nimport { SearchIcon } from 'lucide-react';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\n\nfunction Command({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive>) {\n\treturn (\n\t\t<CommandPrimitive\n\t\t\tclassName={cn(\n\t\t\t\t'nt:flex nt:h-full nt:w-full nt:flex-col nt:overflow-hidden nt:rounded-lg nt:bg-popover nt:text-popover-foreground',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tdata-slot=\"command\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction CommandInput({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n\treturn (\n\t\t<div\n\t\t\tclassName=\"nt:flex nt:items-center nt:gap-2 nt:border-b nt:border-foreground/10 nt:px-3\"\n\t\t\tdata-slot=\"command-input-wrapper\"\n\t\t>\n\t\t\t<SearchIcon className=\"nt:size-4 nt:shrink-0 nt:opacity-50\" />\n\t\t\t<CommandPrimitive.Input\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'nt:flex nt:h-9 nt:w-full nt:rounded-md nt:bg-transparent nt:py-3 nt:text-sm nt:outline-hidden nt:placeholder:text-muted-foreground nt:disabled:cursor-not-allowed nt:disabled:opacity-50',\n\t\t\t\t\tclassName\n\t\t\t\t)}\n\t\t\t\tdata-slot=\"command-input\"\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction CommandList({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive.List>) {\n\treturn (\n\t\t<CommandPrimitive.List\n\t\t\tclassName={cn(\n\t\t\t\t'nt:max-h-[300px] nt:scroll-py-1 nt:overflow-x-hidden nt:overflow-y-auto',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tdata-slot=\"command-list\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction CommandEmpty({\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n\treturn (\n\t\t<CommandPrimitive.Empty\n\t\t\tclassName=\"nt:py-6 nt:text-center nt:text-sm\"\n\t\t\tdata-slot=\"command-empty\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction CommandGroup({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n\treturn (\n\t\t<CommandPrimitive.Group\n\t\t\tclassName={cn(\n\t\t\t\t'nt:overflow-hidden nt:p-1 nt:text-foreground nt:[&_[cmdk-group-heading]]:px-2 nt:[&_[cmdk-group-heading]]:py-1.5 nt:[&_[cmdk-group-heading]]:text-xs nt:[&_[cmdk-group-heading]]:font-medium nt:[&_[cmdk-group-heading]]:text-muted-foreground',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tdata-slot=\"command-group\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction CommandItem({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof CommandPrimitive.Item>) {\n\treturn (\n\t\t<CommandPrimitive.Item\n\t\t\tclassName={cn(\n\t\t\t\t'nt:relative nt:flex nt:cursor-default nt:items-center nt:gap-2 nt:rounded-md nt:px-2 nt:py-1.5 nt:text-sm nt:outline-hidden nt:select-none nt:data-[selected=true]:bg-accent nt:data-[selected=true]:text-accent-foreground nt:data-[disabled=true]:pointer-events-none nt:data-[disabled=true]:opacity-50',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tdata-slot=\"command-item\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tCommand,\n\tCommandEmpty,\n\tCommandGroup,\n\tCommandInput,\n\tCommandItem,\n\tCommandList\n};\n"],"mappings":"AAWE,cAgBA,YAhBA;AAXF,SAAS,WAAW,wBAAwB;AAC5C,SAAS,kBAAkB;AAG3B,SAAS,UAAU;AAEnB,SAAS,QAAQ;AAAA,EAChB;AAAA,EACA,GAAG;AACJ,GAAkD;AACjD,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAW;AAAA,QACV;AAAA,QACA;AAAA,MACD;AAAA,MACA,aAAU;AAAA,MACT,GAAG;AAAA;AAAA,EACL;AAEF;AAEA,SAAS,aAAa;AAAA,EACrB;AAAA,EACA,GAAG;AACJ,GAAwD;AACvD,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,aAAU;AAAA,MAEV;AAAA,4BAAC,cAAW,WAAU,uCAAsC;AAAA,QAC5D;AAAA,UAAC,iBAAiB;AAAA,UAAjB;AAAA,YACA,WAAW;AAAA,cACV;AAAA,cACA;AAAA,YACD;AAAA,YACA,aAAU;AAAA,YACT,GAAG;AAAA;AAAA,QACL;AAAA;AAAA;AAAA,EACD;AAEF;AAEA,SAAS,YAAY;AAAA,EACpB;AAAA,EACA,GAAG;AACJ,GAAuD;AACtD,SACC;AAAA,IAAC,iBAAiB;AAAA,IAAjB;AAAA,MACA,WAAW;AAAA,QACV;AAAA,QACA;AAAA,MACD;AAAA,MACA,aAAU;AAAA,MACT,GAAG;AAAA;AAAA,EACL;AAEF;AAEA,SAAS,aAAa;AAAA,EACrB,GAAG;AACJ,GAAwD;AACvD,SACC;AAAA,IAAC,iBAAiB;AAAA,IAAjB;AAAA,MACA,WAAU;AAAA,MACV,aAAU;AAAA,MACT,GAAG;AAAA;AAAA,EACL;AAEF;AAEA,SAAS,aAAa;AAAA,EACrB;AAAA,EACA,GAAG;AACJ,GAAwD;AACvD,SACC;AAAA,IAAC,iBAAiB;AAAA,IAAjB;AAAA,MACA,WAAW;AAAA,QACV;AAAA,QACA;AAAA,MACD;AAAA,MACA,aAAU;AAAA,MACT,GAAG;AAAA;AAAA,EACL;AAEF;AAEA,SAAS,YAAY;AAAA,EACpB;AAAA,EACA,GAAG;AACJ,GAAuD;AACtD,SACC;AAAA,IAAC,iBAAiB;AAAA,IAAjB;AAAA,MACA,WAAW;AAAA,QACV;AAAA,QACA;AAAA,MACD;AAAA,MACA,aAAU;AAAA,MACT,GAAG;AAAA;AAAA,EACL;AAEF;","names":[]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,30 +15,89 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var code_block_exports = {};
|
|
30
20
|
__export(code_block_exports, {
|
|
31
|
-
CodeBlockExtension: () => CodeBlockExtension
|
|
21
|
+
CodeBlockExtension: () => CodeBlockExtension,
|
|
22
|
+
createCodeBlockExtension: () => createCodeBlockExtension,
|
|
23
|
+
defaultLowlight: () => defaultLowlight
|
|
32
24
|
});
|
|
33
25
|
module.exports = __toCommonJS(code_block_exports);
|
|
34
|
-
var
|
|
26
|
+
var import_core = require("@tiptap/core");
|
|
27
|
+
var import_extension_code_block_lowlight = require("@tiptap/extension-code-block-lowlight");
|
|
35
28
|
var import_react = require("@tiptap/react");
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
var import_lowlight = require("lowlight");
|
|
30
|
+
var import_code_block_view = require("../components/code-block-view/code-block-view");
|
|
31
|
+
var import_languages = require("../lib/languages");
|
|
32
|
+
const defaultLowlight = (0, import_lowlight.createLowlight)(import_lowlight.common);
|
|
33
|
+
const backtickInputRegex = /^```([a-z]+)?[\s\n]$/;
|
|
34
|
+
const tildeInputRegex = /^~~~([a-z]+)?[\s\n]$/;
|
|
35
|
+
function createCodeBlockExtension(lowlight) {
|
|
36
|
+
return import_extension_code_block_lowlight.CodeBlockLowlight.configure({
|
|
37
|
+
lowlight,
|
|
38
|
+
// Tab inserts spaces instead of leaving the editor; Shift-Tab dedents.
|
|
39
|
+
enableTabIndentation: true,
|
|
40
|
+
tabSize: 2
|
|
41
|
+
}).extend({
|
|
42
|
+
addNodeView() {
|
|
43
|
+
return (0, import_react.ReactNodeViewRenderer)(import_code_block_view.CodeBlockView);
|
|
44
|
+
},
|
|
45
|
+
addKeyboardShortcuts() {
|
|
46
|
+
const parent = this.parent?.() ?? {};
|
|
47
|
+
return {
|
|
48
|
+
...parent,
|
|
49
|
+
Tab: ({ editor }) => {
|
|
50
|
+
if (!this.options.enableTabIndentation) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
const tabSize = this.options.tabSize ?? 2;
|
|
54
|
+
const { selection } = editor.state;
|
|
55
|
+
const { $from, empty } = selection;
|
|
56
|
+
if ($from.parent.type !== this.type) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const indent = " ".repeat(tabSize);
|
|
60
|
+
if (empty) {
|
|
61
|
+
return editor.commands.command(({ tr }) => {
|
|
62
|
+
tr.insertText(indent);
|
|
63
|
+
return true;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return editor.commands.command(({ tr, state }) => {
|
|
67
|
+
const { from, to } = selection;
|
|
68
|
+
const text = state.doc.textBetween(from, to, "\n", "\n");
|
|
69
|
+
const indented = text.split("\n").map((line) => indent + line).join("\n");
|
|
70
|
+
tr.replaceWith(from, to, state.schema.text(indented));
|
|
71
|
+
return true;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
addInputRules() {
|
|
77
|
+
return [
|
|
78
|
+
(0, import_core.textblockTypeInputRule)({
|
|
79
|
+
find: backtickInputRegex,
|
|
80
|
+
type: this.type,
|
|
81
|
+
getAttributes: (match) => ({
|
|
82
|
+
language: (0, import_languages.normalizeLanguage)(match[1])
|
|
83
|
+
})
|
|
84
|
+
}),
|
|
85
|
+
(0, import_core.textblockTypeInputRule)({
|
|
86
|
+
find: tildeInputRegex,
|
|
87
|
+
type: this.type,
|
|
88
|
+
getAttributes: (match) => ({
|
|
89
|
+
language: (0, import_languages.normalizeLanguage)(match[1])
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const CodeBlockExtension = createCodeBlockExtension(defaultLowlight);
|
|
42
97
|
// Annotate the CommonJS export names for ESM import in node:
|
|
43
98
|
0 && (module.exports = {
|
|
44
|
-
CodeBlockExtension
|
|
99
|
+
CodeBlockExtension,
|
|
100
|
+
createCodeBlockExtension,
|
|
101
|
+
defaultLowlight
|
|
45
102
|
});
|
|
46
103
|
//# sourceMappingURL=code-block.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/extensions/code-block.ts"],"sourcesContent":["import
|
|
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\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,aAAO;AAAA,QACN,GAAG;AAAA,QACH,KAAK,CAAC,EAAE,OAAO,MAAM;AACpB,cAAI,CAAC,KAAK,QAAQ,sBAAsB;AACvC,mBAAO;AAAA,UACR;AAEA,gBAAM,UAAU,KAAK,QAAQ,WAAW;AACxC,gBAAM,EAAE,UAAU,IAAI,OAAO;AAC7B,gBAAM,EAAE,OAAO,MAAM,IAAI;AAEzB,cAAI,MAAM,OAAO,SAAS,KAAK,MAAM;AACpC,mBAAO;AAAA,UACR;AAEA,gBAAM,SAAS,IAAI,OAAO,OAAO;AAEjC,cAAI,OAAO;AACV,mBAAO,OAAO,SAAS,QAAQ,CAAC,EAAE,GAAG,MAAM;AAC1C,iBAAG,WAAW,MAAM;AAEpB,qBAAO;AAAA,YACR,CAAC;AAAA,UACF;AAEA,iBAAO,OAAO,SAAS,QAAQ,CAAC,EAAE,IAAI,MAAM,MAAM;AACjD,kBAAM,EAAE,MAAM,GAAG,IAAI;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,6 +1,10 @@
|
|
|
1
1
|
import * as _tiptap_core from '@tiptap/core';
|
|
2
|
-
import * as
|
|
2
|
+
import * as _tiptap_extension_code_block_lowlight from '@tiptap/extension-code-block-lowlight';
|
|
3
|
+
import { createLowlight } from 'lowlight';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
type Lowlight = ReturnType<typeof createLowlight>;
|
|
6
|
+
declare const defaultLowlight: Lowlight;
|
|
7
|
+
declare function createCodeBlockExtension(lowlight: Lowlight): _tiptap_core.Node<_tiptap_extension_code_block_lowlight.CodeBlockLowlightOptions, any>;
|
|
8
|
+
declare const CodeBlockExtension: _tiptap_core.Node<_tiptap_extension_code_block_lowlight.CodeBlockLowlightOptions, any>;
|
|
5
9
|
|
|
6
|
-
export { CodeBlockExtension };
|
|
10
|
+
export { CodeBlockExtension, createCodeBlockExtension, defaultLowlight };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as _tiptap_core from '@tiptap/core';
|
|
2
|
-
import * as
|
|
2
|
+
import * as _tiptap_extension_code_block_lowlight from '@tiptap/extension-code-block-lowlight';
|
|
3
|
+
import { createLowlight } from 'lowlight';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
type Lowlight = ReturnType<typeof createLowlight>;
|
|
6
|
+
declare const defaultLowlight: Lowlight;
|
|
7
|
+
declare function createCodeBlockExtension(lowlight: Lowlight): _tiptap_core.Node<_tiptap_extension_code_block_lowlight.CodeBlockLowlightOptions, any>;
|
|
8
|
+
declare const CodeBlockExtension: _tiptap_core.Node<_tiptap_extension_code_block_lowlight.CodeBlockLowlightOptions, any>;
|
|
5
9
|
|
|
6
|
-
export { CodeBlockExtension };
|
|
10
|
+
export { CodeBlockExtension, createCodeBlockExtension, defaultLowlight };
|
|
@@ -1,12 +1,77 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { textblockTypeInputRule } from "@tiptap/core";
|
|
2
|
+
import { CodeBlockLowlight } from "@tiptap/extension-code-block-lowlight";
|
|
2
3
|
import { ReactNodeViewRenderer } from "@tiptap/react";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { common, createLowlight } from "lowlight";
|
|
5
|
+
import { CodeBlockView } from "../components/code-block-view/code-block-view";
|
|
6
|
+
import { normalizeLanguage } from "../lib/languages";
|
|
7
|
+
const defaultLowlight = createLowlight(common);
|
|
8
|
+
const backtickInputRegex = /^```([a-z]+)?[\s\n]$/;
|
|
9
|
+
const tildeInputRegex = /^~~~([a-z]+)?[\s\n]$/;
|
|
10
|
+
function createCodeBlockExtension(lowlight) {
|
|
11
|
+
return CodeBlockLowlight.configure({
|
|
12
|
+
lowlight,
|
|
13
|
+
// Tab inserts spaces instead of leaving the editor; Shift-Tab dedents.
|
|
14
|
+
enableTabIndentation: true,
|
|
15
|
+
tabSize: 2
|
|
16
|
+
}).extend({
|
|
17
|
+
addNodeView() {
|
|
18
|
+
return ReactNodeViewRenderer(CodeBlockView);
|
|
19
|
+
},
|
|
20
|
+
addKeyboardShortcuts() {
|
|
21
|
+
const parent = this.parent?.() ?? {};
|
|
22
|
+
return {
|
|
23
|
+
...parent,
|
|
24
|
+
Tab: ({ editor }) => {
|
|
25
|
+
if (!this.options.enableTabIndentation) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
const tabSize = this.options.tabSize ?? 2;
|
|
29
|
+
const { selection } = editor.state;
|
|
30
|
+
const { $from, empty } = selection;
|
|
31
|
+
if ($from.parent.type !== this.type) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
const indent = " ".repeat(tabSize);
|
|
35
|
+
if (empty) {
|
|
36
|
+
return editor.commands.command(({ tr }) => {
|
|
37
|
+
tr.insertText(indent);
|
|
38
|
+
return true;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return editor.commands.command(({ tr, state }) => {
|
|
42
|
+
const { from, to } = selection;
|
|
43
|
+
const text = state.doc.textBetween(from, to, "\n", "\n");
|
|
44
|
+
const indented = text.split("\n").map((line) => indent + line).join("\n");
|
|
45
|
+
tr.replaceWith(from, to, state.schema.text(indented));
|
|
46
|
+
return true;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
addInputRules() {
|
|
52
|
+
return [
|
|
53
|
+
textblockTypeInputRule({
|
|
54
|
+
find: backtickInputRegex,
|
|
55
|
+
type: this.type,
|
|
56
|
+
getAttributes: (match) => ({
|
|
57
|
+
language: normalizeLanguage(match[1])
|
|
58
|
+
})
|
|
59
|
+
}),
|
|
60
|
+
textblockTypeInputRule({
|
|
61
|
+
find: tildeInputRegex,
|
|
62
|
+
type: this.type,
|
|
63
|
+
getAttributes: (match) => ({
|
|
64
|
+
language: normalizeLanguage(match[1])
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const CodeBlockExtension = createCodeBlockExtension(defaultLowlight);
|
|
9
72
|
export {
|
|
10
|
-
CodeBlockExtension
|
|
73
|
+
CodeBlockExtension,
|
|
74
|
+
createCodeBlockExtension,
|
|
75
|
+
defaultLowlight
|
|
11
76
|
};
|
|
12
77
|
//# sourceMappingURL=code-block.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/extensions/code-block.ts"],"sourcesContent":["import
|
|
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\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,KAAK,QAAQ,sBAAsB;AACvC,mBAAO;AAAA,UACR;AAEA,gBAAM,UAAU,KAAK,QAAQ,WAAW;AACxC,gBAAM,EAAE,UAAU,IAAI,OAAO;AAC7B,gBAAM,EAAE,OAAO,MAAM,IAAI;AAEzB,cAAI,MAAM,OAAO,SAAS,KAAK,MAAM;AACpC,mBAAO;AAAA,UACR;AAEA,gBAAM,SAAS,IAAI,OAAO,OAAO;AAEjC,cAAI,OAAO;AACV,mBAAO,OAAO,SAAS,QAAQ,CAAC,EAAE,GAAG,MAAM;AAC1C,iBAAG,WAAW,MAAM;AAEpB,qBAAO;AAAA,YACR,CAAC;AAAA,UACF;AAEA,iBAAO,OAAO,SAAS,QAAQ,CAAC,EAAE,IAAI,MAAM,MAAM;AACjD,kBAAM,EAAE,MAAM,GAAG,IAAI;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,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":[]}
|
|
@@ -31,6 +31,7 @@ __export(editor_exports, {
|
|
|
31
31
|
editorExtensions: () => editorExtensions
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(editor_exports);
|
|
34
|
+
var import_extension_image = __toESM(require("@tiptap/extension-image"), 1);
|
|
34
35
|
var import_extension_list = require("@tiptap/extension-list");
|
|
35
36
|
var import_starter_kit = __toESM(require("@tiptap/starter-kit"), 1);
|
|
36
37
|
var import_tiptap_markdown = require("tiptap-markdown");
|
|
@@ -40,6 +41,7 @@ const editorExtensions = [
|
|
|
40
41
|
import_starter_kit.default.configure({ ...import_shared.starterKitBaseConfig, codeBlock: false }),
|
|
41
42
|
import_extension_list.ListKit,
|
|
42
43
|
import_code_block.CodeBlockExtension,
|
|
44
|
+
import_extension_image.default,
|
|
43
45
|
import_tiptap_markdown.Markdown.configure({
|
|
44
46
|
html: false,
|
|
45
47
|
transformPastedText: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/extensions/editor.ts"],"sourcesContent":["import { ListKit } from '@tiptap/extension-list';\nimport StarterKit from '@tiptap/starter-kit';\nimport { Markdown } from 'tiptap-markdown';\n\nimport { CodeBlockExtension } from './code-block';\nimport { starterKitBaseConfig } from './shared';\n\n// Editor extensions = shared content model + interactive features + Markdown\n// codeBlock is disabled in StarterKit and replaced with the custom\n// CodeBlockExtension that mounts a NodeView (CodeBlockView).\nexport const editorExtensions = [\n\tStarterKit.configure({ ...starterKitBaseConfig, codeBlock: false }),\n\tListKit,\n\tCodeBlockExtension,\n\tMarkdown.configure({\n\t\thtml: false,\n\t\ttransformPastedText: true,\n\t\ttransformCopiedText: true\n\t})\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAwB;AACxB,yBAAuB;AACvB,6BAAyB;AAEzB,wBAAmC;AACnC,oBAAqC;AAK9B,MAAM,mBAAmB;AAAA,EAC/B,mBAAAA,QAAW,UAAU,EAAE,GAAG,oCAAsB,WAAW,MAAM,CAAC;AAAA,EAClE;AAAA,EACA;AAAA,EACA,gCAAS,UAAU;AAAA,IAClB,MAAM;AAAA,IACN,qBAAqB;AAAA,IACrB,qBAAqB;AAAA,EACtB,CAAC;AACF;","names":["StarterKit"]}
|
|
1
|
+
{"version":3,"sources":["../../src/extensions/editor.ts"],"sourcesContent":["import Image from '@tiptap/extension-image';\nimport { ListKit } from '@tiptap/extension-list';\nimport StarterKit from '@tiptap/starter-kit';\nimport { Markdown } from 'tiptap-markdown';\n\nimport { CodeBlockExtension } from './code-block';\nimport { starterKitBaseConfig } from './shared';\n\n// Editor extensions = shared content model + interactive features + Markdown\n// codeBlock is disabled in StarterKit and replaced with the custom\n// CodeBlockExtension that mounts a NodeView (CodeBlockView).\nexport const editorExtensions = [\n\tStarterKit.configure({ ...starterKitBaseConfig, codeBlock: false }),\n\tListKit,\n\tCodeBlockExtension,\n\tImage,\n\tMarkdown.configure({\n\t\thtml: false,\n\t\ttransformPastedText: true,\n\t\ttransformCopiedText: true\n\t})\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAkB;AAClB,4BAAwB;AACxB,yBAAuB;AACvB,6BAAyB;AAEzB,wBAAmC;AACnC,oBAAqC;AAK9B,MAAM,mBAAmB;AAAA,EAC/B,mBAAAA,QAAW,UAAU,EAAE,GAAG,oCAAsB,WAAW,MAAM,CAAC;AAAA,EAClE;AAAA,EACA;AAAA,EACA,uBAAAC;AAAA,EACA,gCAAS,UAAU;AAAA,IAClB,MAAM;AAAA,IACN,qBAAqB;AAAA,IACrB,qBAAqB;AAAA,EACtB,CAAC;AACF;","names":["StarterKit","Image"]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as tiptap_markdown from 'tiptap-markdown';
|
|
2
|
-
import * as
|
|
2
|
+
import * as _tiptap_extension_image from '@tiptap/extension-image';
|
|
3
3
|
import * as _tiptap_extension_list from '@tiptap/extension-list';
|
|
4
|
-
import * as _tiptap_core from '@tiptap/core';
|
|
5
4
|
import * as _tiptap_starter_kit from '@tiptap/starter-kit';
|
|
5
|
+
import * as _tiptap_core from '@tiptap/core';
|
|
6
|
+
import * as _tiptap_extension_code_block_lowlight from '@tiptap/extension-code-block-lowlight';
|
|
6
7
|
|
|
7
|
-
declare const editorExtensions: (_tiptap_core.Extension<_tiptap_starter_kit.StarterKitOptions, any> | _tiptap_core.Extension<_tiptap_extension_list.ListKitOptions, any> | _tiptap_core.Node<
|
|
8
|
+
declare const editorExtensions: (_tiptap_core.Node<_tiptap_extension_code_block_lowlight.CodeBlockLowlightOptions, any> | _tiptap_core.Extension<_tiptap_starter_kit.StarterKitOptions, any> | _tiptap_core.Extension<_tiptap_extension_list.ListKitOptions, any> | _tiptap_core.Node<_tiptap_extension_image.ImageOptions, any> | _tiptap_core.Extension<tiptap_markdown.MarkdownOptions, tiptap_markdown.MarkdownStorage>)[];
|
|
8
9
|
|
|
9
10
|
export { editorExtensions };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as tiptap_markdown from 'tiptap-markdown';
|
|
2
|
-
import * as
|
|
2
|
+
import * as _tiptap_extension_image from '@tiptap/extension-image';
|
|
3
3
|
import * as _tiptap_extension_list from '@tiptap/extension-list';
|
|
4
|
-
import * as _tiptap_core from '@tiptap/core';
|
|
5
4
|
import * as _tiptap_starter_kit from '@tiptap/starter-kit';
|
|
5
|
+
import * as _tiptap_core from '@tiptap/core';
|
|
6
|
+
import * as _tiptap_extension_code_block_lowlight from '@tiptap/extension-code-block-lowlight';
|
|
6
7
|
|
|
7
|
-
declare const editorExtensions: (_tiptap_core.Extension<_tiptap_starter_kit.StarterKitOptions, any> | _tiptap_core.Extension<_tiptap_extension_list.ListKitOptions, any> | _tiptap_core.Node<
|
|
8
|
+
declare const editorExtensions: (_tiptap_core.Node<_tiptap_extension_code_block_lowlight.CodeBlockLowlightOptions, any> | _tiptap_core.Extension<_tiptap_starter_kit.StarterKitOptions, any> | _tiptap_core.Extension<_tiptap_extension_list.ListKitOptions, any> | _tiptap_core.Node<_tiptap_extension_image.ImageOptions, any> | _tiptap_core.Extension<tiptap_markdown.MarkdownOptions, tiptap_markdown.MarkdownStorage>)[];
|
|
8
9
|
|
|
9
10
|
export { editorExtensions };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Image from "@tiptap/extension-image";
|
|
1
2
|
import { ListKit } from "@tiptap/extension-list";
|
|
2
3
|
import StarterKit from "@tiptap/starter-kit";
|
|
3
4
|
import { Markdown } from "tiptap-markdown";
|
|
@@ -7,6 +8,7 @@ const editorExtensions = [
|
|
|
7
8
|
StarterKit.configure({ ...starterKitBaseConfig, codeBlock: false }),
|
|
8
9
|
ListKit,
|
|
9
10
|
CodeBlockExtension,
|
|
11
|
+
Image,
|
|
10
12
|
Markdown.configure({
|
|
11
13
|
html: false,
|
|
12
14
|
transformPastedText: true,
|