@pixerate/editor 0.2.3 → 0.4.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/extensions/index.cjs +89 -2
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +28 -1
- package/dist/extensions/index.d.ts +28 -1
- package/dist/extensions/index.js +87 -2
- package/dist/extensions/index.js.map +1 -1
- package/dist/index.cjs +1445 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +1428 -4
- package/dist/index.js.map +1 -1
- package/dist/serializers/index.cjs +85 -2
- package/dist/serializers/index.cjs.map +1 -1
- package/dist/serializers/index.d.cts +15 -2
- package/dist/serializers/index.d.ts +15 -2
- package/dist/serializers/index.js +84 -2
- package/dist/serializers/index.js.map +1 -1
- package/dist/spreadsheet/index.cjs +1297 -0
- package/dist/spreadsheet/index.cjs.map +1 -0
- package/dist/spreadsheet/index.d.cts +268 -0
- package/dist/spreadsheet/index.d.ts +268 -0
- package/dist/spreadsheet/index.js +1259 -0
- package/dist/spreadsheet/index.js.map +1 -0
- package/package.json +7 -1
|
@@ -34,9 +34,11 @@ __export(extensions_exports, {
|
|
|
34
34
|
FontSize: () => FontSize,
|
|
35
35
|
GradientText: () => GradientText,
|
|
36
36
|
LoadingNode: () => LoadingNode,
|
|
37
|
+
Mention: () => Mention,
|
|
37
38
|
SlashCommands: () => SlashCommands,
|
|
38
39
|
SmilieReplacer: () => SmilieReplacer,
|
|
39
40
|
TemplateSuggestions: () => TemplateSuggestions,
|
|
41
|
+
createMentionExtension: () => createMentionExtension,
|
|
40
42
|
createRichTextPreset: () => createRichTextPreset,
|
|
41
43
|
findHexColors: () => findHexColors
|
|
42
44
|
});
|
|
@@ -519,6 +521,7 @@ var FontSize = import_core7.Extension.create({
|
|
|
519
521
|
});
|
|
520
522
|
|
|
521
523
|
// src/extensions/rich-text-preset.ts
|
|
524
|
+
var import_core8 = require("@tiptap/core");
|
|
522
525
|
var import_starter_kit = __toESM(require("@tiptap/starter-kit"), 1);
|
|
523
526
|
var import_extension_color = __toESM(require("@tiptap/extension-color"), 1);
|
|
524
527
|
var import_extension_highlight = __toESM(require("@tiptap/extension-highlight"), 1);
|
|
@@ -531,6 +534,52 @@ var import_extension_typography = __toESM(require("@tiptap/extension-typography"
|
|
|
531
534
|
var import_extension_underline = __toESM(require("@tiptap/extension-underline"), 1);
|
|
532
535
|
var import_extension_placeholder = __toESM(require("@tiptap/extension-placeholder"), 1);
|
|
533
536
|
var import_extension_character_count = __toESM(require("@tiptap/extension-character-count"), 1);
|
|
537
|
+
|
|
538
|
+
// src/extensions/mention.ts
|
|
539
|
+
var import_extension_mention = __toESM(require("@tiptap/extension-mention"), 1);
|
|
540
|
+
var Mention = import_extension_mention.default.extend({
|
|
541
|
+
addAttributes() {
|
|
542
|
+
return {
|
|
543
|
+
...this.parent?.(),
|
|
544
|
+
type: {
|
|
545
|
+
default: null,
|
|
546
|
+
parseHTML: (element) => element.getAttribute("data-type-name") || element.getAttribute("data-entity-type"),
|
|
547
|
+
renderHTML: (attributes) => {
|
|
548
|
+
if (!attributes.type) return {};
|
|
549
|
+
return { "data-type-name": attributes.type };
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
avatarUrl: {
|
|
553
|
+
default: null,
|
|
554
|
+
parseHTML: (element) => element.getAttribute("data-avatar-url"),
|
|
555
|
+
renderHTML: (attributes) => {
|
|
556
|
+
if (!attributes.avatarUrl) return {};
|
|
557
|
+
return { "data-avatar-url": attributes.avatarUrl };
|
|
558
|
+
}
|
|
559
|
+
},
|
|
560
|
+
color: {
|
|
561
|
+
default: null,
|
|
562
|
+
parseHTML: (element) => element.getAttribute("data-color"),
|
|
563
|
+
renderHTML: (attributes) => {
|
|
564
|
+
if (!attributes.color) return {};
|
|
565
|
+
return { "data-color": attributes.color };
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
function createMentionExtension(options = {}) {
|
|
572
|
+
const { HTMLAttributes = {}, ...rest } = options;
|
|
573
|
+
return Mention.configure({
|
|
574
|
+
HTMLAttributes: {
|
|
575
|
+
class: "pixerate-mention-node",
|
|
576
|
+
...HTMLAttributes
|
|
577
|
+
},
|
|
578
|
+
...rest
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// src/extensions/rich-text-preset.ts
|
|
534
583
|
var TextStyle2 = _TextStyle.TextStyle || _TextStyle.default || _TextStyle;
|
|
535
584
|
function createRichTextPreset(options = {}) {
|
|
536
585
|
const {
|
|
@@ -568,7 +617,19 @@ function createRichTextPreset(options = {}) {
|
|
|
568
617
|
import_extension_text_align.default.configure({
|
|
569
618
|
types: ["heading", "paragraph"]
|
|
570
619
|
}),
|
|
571
|
-
import_extension_link.default.
|
|
620
|
+
import_extension_link.default.extend({
|
|
621
|
+
addInputRules() {
|
|
622
|
+
return [
|
|
623
|
+
(0, import_core8.markInputRule)({
|
|
624
|
+
find: /(?:^|\s)\[([^\]]+)\]\(([^)]+)\)$/,
|
|
625
|
+
type: this.type,
|
|
626
|
+
getAttributes: (match) => ({
|
|
627
|
+
href: match[2]
|
|
628
|
+
})
|
|
629
|
+
})
|
|
630
|
+
];
|
|
631
|
+
}
|
|
632
|
+
}).configure({
|
|
572
633
|
openOnClick: openLinksOnClick,
|
|
573
634
|
autolink: true,
|
|
574
635
|
defaultProtocol: "https",
|
|
@@ -579,7 +640,19 @@ function createRichTextPreset(options = {}) {
|
|
|
579
640
|
}
|
|
580
641
|
}),
|
|
581
642
|
import_extension_task_list.default,
|
|
582
|
-
import_extension_task_item.default.
|
|
643
|
+
import_extension_task_item.default.extend({
|
|
644
|
+
addInputRules() {
|
|
645
|
+
return [
|
|
646
|
+
(0, import_core8.wrappingInputRule)({
|
|
647
|
+
find: /^\s*(\[([ |x])?\])\s$/i,
|
|
648
|
+
type: this.type,
|
|
649
|
+
getAttributes: (match) => ({
|
|
650
|
+
checked: match[2]?.toLowerCase() === "x"
|
|
651
|
+
})
|
|
652
|
+
})
|
|
653
|
+
];
|
|
654
|
+
}
|
|
655
|
+
}).configure({
|
|
583
656
|
nested: true
|
|
584
657
|
}),
|
|
585
658
|
FontSize,
|
|
@@ -601,6 +674,18 @@ function createRichTextPreset(options = {}) {
|
|
|
601
674
|
if (enableColorHighlighter) {
|
|
602
675
|
extensions.push(ColorHighlighter);
|
|
603
676
|
}
|
|
677
|
+
if (options.mention) {
|
|
678
|
+
const mentionConfig = typeof options.mention === "object" ? options.mention : {};
|
|
679
|
+
extensions.push(
|
|
680
|
+
Mention.configure({
|
|
681
|
+
HTMLAttributes: {
|
|
682
|
+
class: "pixerate-mention-node",
|
|
683
|
+
...mentionConfig.HTMLAttributes || {}
|
|
684
|
+
},
|
|
685
|
+
...mentionConfig
|
|
686
|
+
})
|
|
687
|
+
);
|
|
688
|
+
}
|
|
604
689
|
return extensions;
|
|
605
690
|
}
|
|
606
691
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -609,9 +694,11 @@ function createRichTextPreset(options = {}) {
|
|
|
609
694
|
FontSize,
|
|
610
695
|
GradientText,
|
|
611
696
|
LoadingNode,
|
|
697
|
+
Mention,
|
|
612
698
|
SlashCommands,
|
|
613
699
|
SmilieReplacer,
|
|
614
700
|
TemplateSuggestions,
|
|
701
|
+
createMentionExtension,
|
|
615
702
|
createRichTextPreset,
|
|
616
703
|
findHexColors
|
|
617
704
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/extensions/index.ts","../../src/extensions/gradient-text.ts","../../src/grammar/tokens.ts","../../src/extensions/slash-commands.ts","../../src/extensions/template-suggestions.ts","../../src/extensions/loading-node.ts","../../src/extensions/SmilieReplacer.ts","../../src/extensions/ColorHighlighter.ts","../../src/extensions/FontSize.ts","../../src/extensions/rich-text-preset.ts"],"sourcesContent":["export * from \"./gradient-text\";\nexport * from \"./slash-commands\";\nexport * from \"./template-suggestions\";\nexport * from \"./loading-node\";\nexport * from \"./SmilieReplacer\";\nexport * from \"./ColorHighlighter\";\nexport * from \"./FontSize\";\nexport * from \"./rich-text-preset\";\n","import { Mark } from \"@tiptap/core\";\nimport { Plugin } from \"@tiptap/pm/state\";\nimport { Decoration, DecorationSet } from \"@tiptap/pm/view\";\nimport type { Node as ProsemirrorNode } from \"@tiptap/pm/model\";\nimport type { EditorState } from \"@tiptap/pm/state\";\nimport { TEMPLATE_REGEX, VARIABLE_REGEX, INSTRUCTION_REGEX, ColorGradient } from \"../grammar/tokens\";\n\nexport interface GradientTextOptions {\n templateColorMap: Map<string, ColorGradient>;\n speed?: number;\n jsonVariables?: string[] | Set<string>;\n onTemplateClick?: (templateName: string, event: MouseEvent) => void;\n}\n\nconst createGradientDecorations = (\n doc: ProsemirrorNode,\n options: GradientTextOptions,\n): Decoration[] => {\n const decorations: Decoration[] = [];\n const speed = options.speed ?? 1;\n const jsonVarSet = options.jsonVariables\n ? options.jsonVariables instanceof Set\n ? options.jsonVariables\n : new Set(options.jsonVariables)\n : null;\n\n doc.descendants((node, pos) => {\n if (node.isText) {\n const text = node.text || \"\";\n let match: RegExpExecArray | null;\n\n // 1. Template: {{templateName}}\n const tmplRegex = new RegExp(TEMPLATE_REGEX.source, TEMPLATE_REGEX.flags);\n while ((match = tmplRegex.exec(text)) !== null) {\n const templateName = match[1].trim();\n const colors = options.templateColorMap?.get(templateName);\n\n if (colors) {\n const start = pos + match.index;\n const end = start + match[0].length;\n const { from: colorFrom, to: colorTo } = colors;\n\n const style = `--bg-size: ${\n speed * 300\n }%; --color-from: ${colorFrom}; --color-to: ${colorTo}; caret-color: #111 !important;`;\n\n decorations.push(\n Decoration.inline(start, end, {\n class:\n \"inline animate-gradient bg-gradient-to-r from-[var(--color-from)] via-[var(--color-to)] to-[var(--color-from)] bg-[length:var(--bg-size)_100%] bg-clip-text text-transparent border border-(--color-to)/20 px-1 py-0.5 rounded-sm cursor-pointer\",\n style,\n \"data-template\": templateName,\n }),\n );\n }\n }\n\n // 2. Instruction: __text__\n const instRegex = new RegExp(\n INSTRUCTION_REGEX.source,\n INSTRUCTION_REGEX.flags,\n );\n while ((match = instRegex.exec(text)) !== null) {\n const content = match[1].trim();\n const colors = options.templateColorMap?.get(content) || {\n from: \"#ffaa40\",\n to: \"#9c40ff\",\n };\n\n const start = pos + match.index;\n const end = start + match[0].length;\n const { from: colorFrom, to: colorTo } = colors;\n\n const style = `--bg-size: ${\n speed * 300\n }%; --color-from: ${colorFrom}; --color-to: ${colorTo}; caret-color: #111 !important;`;\n\n decorations.push(\n Decoration.inline(start, end, {\n class:\n \"italic animate-gradient bg-gradient-to-r from-rose-400 from-50% to-violet-500 to-50% bg-size-[200%_100%] bg-clip-text text-transparent inline-flex items-baseline gap-0.5\",\n style,\n }),\n );\n }\n\n // 3. Variable: {variableName}\n const varRegex = new RegExp(\n VARIABLE_REGEX.source,\n VARIABLE_REGEX.flags,\n );\n while ((match = varRegex.exec(text)) !== null) {\n const variableName = match[1].trim();\n const start = pos + match.index;\n const end = start + match[0].length;\n const isJsonVar = jsonVarSet?.has(variableName);\n\n decorations.push(\n Decoration.inline(start, end, {\n class: isJsonVar\n ? \"bg-violet-400/40 border-b-4 border-rose-300 dark:border-rose-800 inline-flex items-baseline px-1 py-0 text-foreground/80 gap-0.5 rounded-xs\"\n : \"bg-rose-400/40 border-b-4 border-violet-300 dark:border-violet-800 inline-flex items-baseline px-1 py-0 text-foreground/80 gap-0.5 rounded-xs\",\n \"data-variable\": variableName,\n }),\n );\n }\n }\n });\n\n return decorations;\n};\n\nexport const GradientText = Mark.create<GradientTextOptions>({\n name: \"gradientText\",\n\n addOptions() {\n return {\n templateColorMap: new Map(),\n speed: 1,\n jsonVariables: undefined,\n onTemplateClick: undefined,\n };\n },\n\n renderHTML({ HTMLAttributes }) {\n const defaultColors = {\n from: \"#ffaa40\",\n to: \"#9c40ff\",\n };\n const speed = this.options.speed ?? 1;\n const style = `--bg-size: ${speed * 300}%; --color-from: ${\n defaultColors.from\n }; --color-to: ${defaultColors.to}; caret-color: #111 !important;`;\n\n return [\n \"span\",\n {\n class:\n \"inline animate-gradient bg-gradient-to-r from-[var(--color-from)] via-[var(--color-to)] to-[var(--color-from)] bg-[length:var(--bg-size)_100%] bg-clip-text text-transparent\",\n style,\n ...HTMLAttributes,\n },\n 0,\n ];\n },\n\n parseHTML() {\n return [\n {\n tag: \"span\",\n getAttrs: (node) =>\n (node as HTMLElement).classList.contains(\"animate-gradient\") &&\n (node as HTMLElement).classList.contains(\"bg-clip-text\") &&\n null,\n },\n ];\n },\n\n addProseMirrorPlugins() {\n const markOptions = this.options;\n\n return [\n new Plugin({\n state: {\n init(_, { doc }) {\n return DecorationSet.create(\n doc,\n createGradientDecorations(doc, markOptions),\n );\n },\n apply(tr, value: DecorationSet) {\n const newDoc = tr.doc;\n if (tr.docChanged) {\n return DecorationSet.create(\n newDoc,\n createGradientDecorations(newDoc, markOptions),\n );\n }\n return value.map(tr.mapping, newDoc);\n },\n },\n props: {\n decorations(state: EditorState) {\n return (this as any).getState(state) as DecorationSet;\n },\n handleClickOn(view, pos, _node, _nodePos, event) {\n const decorationSet = (this as any).getState(\n view.state,\n ) as DecorationSet;\n const decorations = decorationSet.find(pos, pos + 1);\n\n for (const decoration of decorations) {\n const decorationWithAttrs = decoration as any;\n const templateName =\n decorationWithAttrs.type?.attrs?.[\"data-template\"];\n if (templateName) {\n if (markOptions.onTemplateClick) {\n markOptions.onTemplateClick(templateName, event as MouseEvent);\n }\n if (typeof window !== \"undefined\") {\n window.dispatchEvent(\n new CustomEvent(\"show-gradient-popover\", {\n detail: {\n templateName,\n target: event.target,\n },\n }),\n );\n }\n return true;\n }\n }\n return false;\n },\n },\n }),\n ];\n },\n});\n","/**\n * Canonical regex patterns for prompt editing tokens.\n */\nexport const TEMPLATE_REGEX = /{{\\s*([^}]+?)\\s*}}/g;\nexport const VARIABLE_REGEX = /(?<!\\{)\\{([^{}]+)\\}(?!\\})/g;\nexport const INSTRUCTION_REGEX = /__(.+?)__/g;\n\n// Backward-compatible camelCase aliases\nexport const templateRegex = TEMPLATE_REGEX;\nexport const variableRegex = VARIABLE_REGEX;\nexport const instructionRegex = INSTRUCTION_REGEX;\n\nexport type TokenType = \"template\" | \"variable\" | \"instruction\" | \"text\";\n\nexport interface Token {\n type: TokenType;\n raw: string;\n value: string;\n start: number;\n end: number;\n}\n\nexport interface TemplateVersion {\n id: string;\n version: string | number;\n body: string;\n createdAt?: any;\n [key: string]: any;\n}\n\nexport interface Template {\n id?: string;\n name: string;\n body?: string;\n latestVersion?: string | number;\n versions?: TemplateVersion[];\n color?: string;\n [key: string]: any;\n}\n\nexport interface ColorGradient {\n from: string;\n to: string;\n}\n","import { Extension } from \"@tiptap/core\";\nimport { Plugin } from \"@tiptap/pm/state\";\n\nexport interface SlashCommandMatchData {\n match: RegExpMatchArray;\n query: string;\n from: number;\n to: number;\n coords: { top: number; left: number; bottom: number; right: number };\n}\n\nexport interface SlashCommandsOptions {\n trigger?: string;\n onMatch?: (data: SlashCommandMatchData) => void;\n onClear?: () => void;\n containerId?: string;\n}\n\nexport const SlashCommands = Extension.create<SlashCommandsOptions>({\n name: \"slashCommands\",\n\n addOptions() {\n return {\n trigger: \"/\",\n onMatch: undefined,\n onClear: undefined,\n containerId: undefined,\n };\n },\n\n addProseMirrorPlugins() {\n const opts = this.options;\n\n return [\n new Plugin({\n view() {\n return {\n update(view) {\n const { state } = view;\n const { selection } = state;\n const { $from } = selection;\n\n if (!$from.parent.isTextblock) {\n opts.onClear?.();\n return;\n }\n\n const textBeforeCursor = $from.parent.textBetween(\n 0,\n $from.parentOffset,\n );\n\n const slashMatch = textBeforeCursor.match(\n /(?:^|\\s)\\/([a-zA-Z0-9_-]*)$/,\n );\n\n if (slashMatch) {\n const matchIndex = slashMatch.index ?? 0;\n const offsetInParent =\n matchIndex + (slashMatch[0].startsWith(\" \") ? 1 : 0);\n const matchFrom = $from.start() + offsetInParent;\n const matchTo = $from.pos;\n const coords = view.coordsAtPos($from.pos);\n\n let relativeCoords = {\n top: coords.top,\n left: coords.left,\n bottom: coords.bottom,\n right: coords.right,\n };\n\n if (opts.containerId && typeof document !== \"undefined\") {\n const container = document.getElementById(opts.containerId);\n if (container) {\n const rect = container.getBoundingClientRect();\n relativeCoords = {\n top: coords.bottom - rect.top + 5,\n left: coords.left - rect.left,\n bottom: coords.bottom - rect.top,\n right: coords.right - rect.left,\n };\n }\n }\n\n opts.onMatch?.({\n match: slashMatch,\n query: slashMatch[1] || \"\",\n from: matchFrom,\n to: matchTo,\n coords: relativeCoords,\n });\n } else {\n opts.onClear?.();\n }\n },\n };\n },\n }),\n ];\n },\n});\n","import { Extension } from \"@tiptap/core\";\nimport Suggestion, { SuggestionOptions } from \"@tiptap/suggestion\";\nimport { Template } from \"../grammar/tokens\";\n\nexport interface TemplateSuggestionsOptions {\n templates: Template[];\n char?: string;\n onSuggestion?: (props: {\n query: string;\n range: { from: number; to: number };\n clientRect?: (() => DOMRect | null) | null;\n items: Template[];\n command: (props: { name: string }) => void;\n }) => void;\n}\n\nexport const TemplateSuggestions = Extension.create<TemplateSuggestionsOptions>({\n name: \"templateSuggestions\",\n\n addOptions() {\n return {\n templates: [],\n char: \"{{\",\n onSuggestion: undefined,\n };\n },\n\n addProseMirrorPlugins() {\n const opts = this.options;\n\n const suggestionConfig: Omit<SuggestionOptions<Template>, \"editor\"> = {\n char: opts.char || \"{{\",\n items: ({ query }) => {\n const lower = query.toLowerCase();\n return (opts.templates || []).filter((t) =>\n t.name.toLowerCase().includes(lower),\n );\n },\n command: ({ editor, range, props }) => {\n editor\n .chain()\n .focus()\n .deleteRange(range)\n .insertContent(`{{${props.name}}}`)\n .run();\n },\n render: () => {\n return {\n onStart: (props) => {\n opts.onSuggestion?.(props as any);\n },\n onUpdate: (props) => {\n opts.onSuggestion?.(props as any);\n },\n onExit: () => {\n opts.onSuggestion?.({\n query: \"\",\n range: { from: 0, to: 0 },\n items: [],\n command: () => {},\n });\n },\n };\n },\n };\n\n const SuggestionFn =\n typeof Suggestion === \"function\"\n ? Suggestion\n : (Suggestion as any)?.default || (Suggestion as any)?.Suggestion;\n\n return [\n SuggestionFn({\n editor: this.editor,\n ...suggestionConfig,\n }),\n ];\n },\n});\n","import { Node, mergeAttributes } from \"@tiptap/core\";\n\nexport const LoadingNode = Node.create({\n name: \"loadingNode\",\n group: \"inline\",\n inline: true,\n selectable: true,\n atom: true,\n\n addAttributes() {\n return {\n id: {\n default: null,\n parseHTML: (element) => element.getAttribute(\"data-id\"),\n renderHTML: (attributes) => {\n if (!attributes.id) return {};\n return { \"data-id\": attributes.id };\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'span[data-type=\"loading\"]',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n \"span\",\n mergeAttributes(HTMLAttributes, {\n \"data-type\": \"loading\",\n class: \"inline-flex items-center px-1.5 py-0.5 text-xs text-muted-foreground animate-pulse\",\n }),\n \"⏳\",\n ];\n },\n});\n","import { Extension, textInputRule } from \"@tiptap/core\";\n\nexport const SmilieReplacer = Extension.create({\n name: \"smilieReplacer\",\n\n addInputRules() {\n return [\n textInputRule({ find: /-___- $/, replace: \"😑 \" }),\n textInputRule({ find: /:'-\\) $/, replace: \"😂 \" }),\n textInputRule({ find: /':-\\) $/, replace: \"😅 \" }),\n textInputRule({ find: /':-D $/, replace: \"😅 \" }),\n textInputRule({ find: />:-\\) $/, replace: \"😆 \" }),\n textInputRule({ find: /-__- $/, replace: \"😑 \" }),\n textInputRule({ find: /':-\\( $/, replace: \"😓 \" }),\n textInputRule({ find: /:'-\\( $/, replace: \"😢 \" }),\n textInputRule({ find: />:-\\( $/, replace: \"😠 \" }),\n textInputRule({ find: /O:-\\) $/, replace: \"😇 \" }),\n textInputRule({ find: /:'\\) $/, replace: \"😂 \" }),\n textInputRule({ find: /:-D $/, replace: \"😃 \" }),\n textInputRule({ find: /':\\) $/, replace: \"😅 \" }),\n textInputRule({ find: /;-\\) $/, replace: \"😉 \" }),\n textInputRule({ find: /B-\\) $/, replace: \"😎 \" }),\n textInputRule({ find: /:-\\* $/, replace: \"😘 \" }),\n textInputRule({ find: /:-\\) $/, replace: \"🙂 \" }),\n textInputRule({ find: /-_- $/, replace: \"😑 \" }),\n textInputRule({ find: /:-O $/, replace: \"😮 \" }),\n textInputRule({ find: /:-P $/, replace: \"😛 \" }),\n textInputRule({ find: /:-p $/, replace: \"😛 \" }),\n textInputRule({ find: /:-\\/ $/, replace: \"😕 \" }),\n textInputRule({ find: /:-\\( $/, replace: \"😞 \" }),\n textInputRule({ find: /:'\\( $/, replace: \"😢 \" }),\n textInputRule({ find: /:D $/, replace: \"😃 \" }),\n textInputRule({ find: /=D $/, replace: \"😃 \" }),\n textInputRule({ find: /;\\) $/, replace: \"😉 \" }),\n textInputRule({ find: /B\\) $/, replace: \"😎 \" }),\n textInputRule({ find: /:\\) $/, replace: \"🙂 \" }),\n textInputRule({ find: /=\\) $/, replace: \"🙂 \" }),\n textInputRule({ find: /:O $/, replace: \"😮 \" }),\n textInputRule({ find: /:P $/, replace: \"😛 \" }),\n textInputRule({ find: /:p $/, replace: \"😛 \" }),\n textInputRule({ find: /:\\/ $/, replace: \"😕 \" }),\n textInputRule({ find: /:\\( $/, replace: \"😞 \" }),\n textInputRule({ find: /<3 $/, replace: \"❤️ \" }),\n textInputRule({ find: /<\\/3 $/, replace: \"💔 \" }),\n textInputRule({ find: /\\/shrug $/, replace: \"¯\\\\_(ツ)_/¯ \" }),\n ];\n },\n});\n","import { Extension } from \"@tiptap/core\";\nimport { Plugin } from \"@tiptap/pm/state\";\nimport { Decoration, DecorationSet } from \"@tiptap/pm/view\";\nimport type { Node as ProsemirrorNode } from \"@tiptap/pm/model\";\n\nexport function findHexColors(doc: ProsemirrorNode): DecorationSet {\n const hexColorRegex = /(#[0-9a-fA-F]{3,8})\\b/g;\n const decorations: Decoration[] = [];\n\n doc.descendants((node, position) => {\n if (!node.text) return;\n\n let match: RegExpExecArray | null;\n while ((match = hexColorRegex.exec(node.text)) !== null) {\n const color = match[0];\n const from = position + match.index;\n const to = from + color.length;\n\n decorations.push(\n Decoration.inline(from, to, {\n class: \"color-highlight px-1 py-0.5 rounded text-xs font-mono border\",\n style: `--color: ${color}; background-color: ${color}20; border-color: ${color}; color: ${color};`,\n }),\n );\n }\n });\n\n return DecorationSet.create(doc, decorations);\n}\n\nexport const ColorHighlighter = Extension.create({\n name: \"colorHighlighter\",\n\n addProseMirrorPlugins() {\n return [\n new Plugin({\n state: {\n init(_, { doc }) {\n return findHexColors(doc);\n },\n apply(transaction, oldState) {\n return transaction.docChanged ? findHexColors(transaction.doc) : oldState;\n },\n },\n props: {\n decorations(state) {\n return (this as any).getState(state);\n },\n },\n }),\n ];\n },\n});\n","import { Extension } from \"@tiptap/core\";\nimport \"@tiptap/extension-text-style\";\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n fontSize: {\n setFontSize: (size: string) => ReturnType;\n unsetFontSize: () => ReturnType;\n };\n }\n}\n\nexport const FontSize = Extension.create({\n name: \"fontSize\",\n\n addOptions() {\n return {\n types: [\"textStyle\"],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n fontSize: {\n default: null,\n parseHTML: (element) =>\n element.style.fontSize.replace(/['\"]+/g, \"\"),\n renderHTML: (attributes) => {\n if (!attributes.fontSize) {\n return {};\n }\n return {\n style: `font-size: ${attributes.fontSize}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setFontSize:\n (fontSize: string) =>\n ({ chain }) =>\n chain().setMark(\"textStyle\", { fontSize }).run(),\n unsetFontSize:\n () =>\n ({ chain }) =>\n chain()\n .setMark(\"textStyle\", { fontSize: null })\n .removeEmptyTextStyle()\n .run(),\n };\n },\n});\n\nexport default FontSize;\n","import type { Extensions } from \"@tiptap/core\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport Color from \"@tiptap/extension-color\";\nimport Highlight from \"@tiptap/extension-highlight\";\nimport Link from \"@tiptap/extension-link\";\nimport TaskList from \"@tiptap/extension-task-list\";\nimport TaskItem from \"@tiptap/extension-task-item\";\nimport TextAlign from \"@tiptap/extension-text-align\";\nimport * as _TextStyle from \"@tiptap/extension-text-style\";\nconst TextStyle = (_TextStyle as any).TextStyle || (_TextStyle as any).default || _TextStyle;\nimport Typography from \"@tiptap/extension-typography\";\nimport Underline from \"@tiptap/extension-underline\";\nimport Placeholder from \"@tiptap/extension-placeholder\";\nimport CharacterCount from \"@tiptap/extension-character-count\";\n\nimport { SmilieReplacer } from \"./SmilieReplacer\";\nimport { ColorHighlighter } from \"./ColorHighlighter\";\nimport { FontSize } from \"./FontSize\";\n\nexport interface RichTextPresetOptions {\n placeholder?: string | ((props: { node: any }) => string);\n characterLimit?: number;\n openLinksOnClick?: boolean;\n enableSmilies?: boolean;\n enableColorHighlighter?: boolean;\n headingLevels?: (1 | 2 | 3 | 4 | 5 | 6)[];\n}\n\n/**\n * Creates a standard rich-text extensions bundle with full formatting support.\n */\nexport function createRichTextPreset(\n options: RichTextPresetOptions = {},\n): Extensions {\n const {\n placeholder = \"Start typing...\",\n characterLimit,\n openLinksOnClick = false,\n enableSmilies = true,\n enableColorHighlighter = true,\n headingLevels = [1, 2, 3, 4],\n } = options;\n\n const extensions: Extensions = [\n StarterKit.configure({\n orderedList: {\n HTMLAttributes: {\n class: \"list-decimal pl-4\",\n },\n },\n bulletList: {\n HTMLAttributes: {\n class: \"list-disc pl-4\",\n },\n },\n heading: {\n levels: headingLevels,\n HTMLAttributes: {\n class: \"font-bold tracking-tight\",\n },\n },\n }),\n TextStyle,\n Color,\n Highlight.configure({ multicolor: true }),\n Underline,\n Typography,\n TextAlign.configure({\n types: [\"heading\", \"paragraph\"],\n }),\n Link.configure({\n openOnClick: openLinksOnClick,\n autolink: true,\n defaultProtocol: \"https\",\n HTMLAttributes: {\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n class: \"text-blue-500 underline underline-offset-2\",\n },\n }),\n TaskList,\n TaskItem.configure({\n nested: true,\n }),\n FontSize,\n Placeholder.configure({\n emptyEditorClass: \"is-empty\",\n placeholder:\n typeof placeholder === \"function\"\n ? placeholder\n : () => placeholder,\n }),\n ];\n\n if (characterLimit) {\n extensions.push(\n CharacterCount.configure({\n limit: characterLimit,\n }),\n );\n }\n\n if (enableSmilies) {\n extensions.push(SmilieReplacer);\n }\n\n if (enableColorHighlighter) {\n extensions.push(ColorHighlighter);\n }\n\n return extensions;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAqB;AACrB,mBAAuB;AACvB,kBAA0C;;;ACCnC,IAAM,iBAAiB;AACvB,IAAM,iBAAiB;AACvB,IAAM,oBAAoB;;;ADSjC,IAAM,4BAA4B,CAChC,KACA,YACiB;AACjB,QAAM,cAA4B,CAAC;AACnC,QAAM,QAAQ,QAAQ,SAAS;AAC/B,QAAM,aAAa,QAAQ,gBACvB,QAAQ,yBAAyB,MAC/B,QAAQ,gBACR,IAAI,IAAI,QAAQ,aAAa,IAC/B;AAEJ,MAAI,YAAY,CAAC,MAAM,QAAQ;AAC7B,QAAI,KAAK,QAAQ;AACf,YAAM,OAAO,KAAK,QAAQ;AAC1B,UAAI;AAGJ,YAAM,YAAY,IAAI,OAAO,eAAe,QAAQ,eAAe,KAAK;AACxE,cAAQ,QAAQ,UAAU,KAAK,IAAI,OAAO,MAAM;AAC9C,cAAM,eAAe,MAAM,CAAC,EAAE,KAAK;AACnC,cAAM,SAAS,QAAQ,kBAAkB,IAAI,YAAY;AAEzD,YAAI,QAAQ;AACV,gBAAM,QAAQ,MAAM,MAAM;AAC1B,gBAAM,MAAM,QAAQ,MAAM,CAAC,EAAE;AAC7B,gBAAM,EAAE,MAAM,WAAW,IAAI,QAAQ,IAAI;AAEzC,g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A,MAAI,gBAAgB;AAClB,eAAW;AAAA,MACT,iCAAAC,QAAe,UAAU;AAAA,QACvB,OAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,eAAe;AACjB,eAAW,KAAK,cAAc;AAAA,EAChC;AAEA,MAAI,wBAAwB;AAC1B,eAAW,KAAK,gBAAgB;AAAA,EAClC;AAEA,SAAO;AACT;","names":["import_core","import_state","import_core","Suggestion","import_core","import_core","import_core","import_state","import_view","import_core","TextStyle","StarterKit","Color","Highlight","Underline","Typography","TextAlign","Link","TaskList","TaskItem","Placeholder","CharacterCount"]}
|
|
1
|
+
{"version":3,"sources":["../../src/extensions/index.ts","../../src/extensions/gradient-text.ts","../../src/grammar/tokens.ts","../../src/extensions/slash-commands.ts","../../src/extensions/template-suggestions.ts","../../src/extensions/loading-node.ts","../../src/extensions/SmilieReplacer.ts","../../src/extensions/ColorHighlighter.ts","../../src/extensions/FontSize.ts","../../src/extensions/rich-text-preset.ts","../../src/extensions/mention.ts"],"sourcesContent":["export * from \"./gradient-text\";\nexport * from \"./slash-commands\";\nexport * from \"./template-suggestions\";\nexport * from \"./loading-node\";\nexport * from \"./SmilieReplacer\";\nexport * from \"./ColorHighlighter\";\nexport * from \"./FontSize\";\nexport * from \"./rich-text-preset\";\nexport * from \"./mention\";\n","import { Mark } from \"@tiptap/core\";\nimport { Plugin } from \"@tiptap/pm/state\";\nimport { Decoration, DecorationSet } from \"@tiptap/pm/view\";\nimport type { Node as ProsemirrorNode } from \"@tiptap/pm/model\";\nimport type { EditorState } from \"@tiptap/pm/state\";\nimport { TEMPLATE_REGEX, VARIABLE_REGEX, INSTRUCTION_REGEX, ColorGradient } from \"../grammar/tokens\";\n\nexport interface GradientTextOptions {\n templateColorMap: Map<string, ColorGradient>;\n speed?: number;\n jsonVariables?: string[] | Set<string>;\n onTemplateClick?: (templateName: string, event: MouseEvent) => void;\n}\n\nconst createGradientDecorations = (\n doc: ProsemirrorNode,\n options: GradientTextOptions,\n): Decoration[] => {\n const decorations: Decoration[] = [];\n const speed = options.speed ?? 1;\n const jsonVarSet = options.jsonVariables\n ? options.jsonVariables instanceof Set\n ? options.jsonVariables\n : new Set(options.jsonVariables)\n : null;\n\n doc.descendants((node, pos) => {\n if (node.isText) {\n const text = node.text || \"\";\n let match: RegExpExecArray | null;\n\n // 1. Template: {{templateName}}\n const tmplRegex = new RegExp(TEMPLATE_REGEX.source, TEMPLATE_REGEX.flags);\n while ((match = tmplRegex.exec(text)) !== null) {\n const templateName = match[1].trim();\n const colors = options.templateColorMap?.get(templateName);\n\n if (colors) {\n const start = pos + match.index;\n const end = start + match[0].length;\n const { from: colorFrom, to: colorTo } = colors;\n\n const style = `--bg-size: ${\n speed * 300\n }%; --color-from: ${colorFrom}; --color-to: ${colorTo}; caret-color: #111 !important;`;\n\n decorations.push(\n Decoration.inline(start, end, {\n class:\n \"inline animate-gradient bg-gradient-to-r from-[var(--color-from)] via-[var(--color-to)] to-[var(--color-from)] bg-[length:var(--bg-size)_100%] bg-clip-text text-transparent border border-(--color-to)/20 px-1 py-0.5 rounded-sm cursor-pointer\",\n style,\n \"data-template\": templateName,\n }),\n );\n }\n }\n\n // 2. Instruction: __text__\n const instRegex = new RegExp(\n INSTRUCTION_REGEX.source,\n INSTRUCTION_REGEX.flags,\n );\n while ((match = instRegex.exec(text)) !== null) {\n const content = match[1].trim();\n const colors = options.templateColorMap?.get(content) || {\n from: \"#ffaa40\",\n to: \"#9c40ff\",\n };\n\n const start = pos + match.index;\n const end = start + match[0].length;\n const { from: colorFrom, to: colorTo } = colors;\n\n const style = `--bg-size: ${\n speed * 300\n }%; --color-from: ${colorFrom}; --color-to: ${colorTo}; caret-color: #111 !important;`;\n\n decorations.push(\n Decoration.inline(start, end, {\n class:\n \"italic animate-gradient bg-gradient-to-r from-rose-400 from-50% to-violet-500 to-50% bg-size-[200%_100%] bg-clip-text text-transparent inline-flex items-baseline gap-0.5\",\n style,\n }),\n );\n }\n\n // 3. Variable: {variableName}\n const varRegex = new RegExp(\n VARIABLE_REGEX.source,\n VARIABLE_REGEX.flags,\n );\n while ((match = varRegex.exec(text)) !== null) {\n const variableName = match[1].trim();\n const start = pos + match.index;\n const end = start + match[0].length;\n const isJsonVar = jsonVarSet?.has(variableName);\n\n decorations.push(\n Decoration.inline(start, end, {\n class: isJsonVar\n ? \"bg-violet-400/40 border-b-4 border-rose-300 dark:border-rose-800 inline-flex items-baseline px-1 py-0 text-foreground/80 gap-0.5 rounded-xs\"\n : \"bg-rose-400/40 border-b-4 border-violet-300 dark:border-violet-800 inline-flex items-baseline px-1 py-0 text-foreground/80 gap-0.5 rounded-xs\",\n \"data-variable\": variableName,\n }),\n );\n }\n }\n });\n\n return decorations;\n};\n\nexport const GradientText = Mark.create<GradientTextOptions>({\n name: \"gradientText\",\n\n addOptions() {\n return {\n templateColorMap: new Map(),\n speed: 1,\n jsonVariables: undefined,\n onTemplateClick: undefined,\n };\n },\n\n renderHTML({ HTMLAttributes }) {\n const defaultColors = {\n from: \"#ffaa40\",\n to: \"#9c40ff\",\n };\n const speed = this.options.speed ?? 1;\n const style = `--bg-size: ${speed * 300}%; --color-from: ${\n defaultColors.from\n }; --color-to: ${defaultColors.to}; caret-color: #111 !important;`;\n\n return [\n \"span\",\n {\n class:\n \"inline animate-gradient bg-gradient-to-r from-[var(--color-from)] via-[var(--color-to)] to-[var(--color-from)] bg-[length:var(--bg-size)_100%] bg-clip-text text-transparent\",\n style,\n ...HTMLAttributes,\n },\n 0,\n ];\n },\n\n parseHTML() {\n return [\n {\n tag: \"span\",\n getAttrs: (node) =>\n (node as HTMLElement).classList.contains(\"animate-gradient\") &&\n (node as HTMLElement).classList.contains(\"bg-clip-text\") &&\n null,\n },\n ];\n },\n\n addProseMirrorPlugins() {\n const markOptions = this.options;\n\n return [\n new Plugin({\n state: {\n init(_, { doc }) {\n return DecorationSet.create(\n doc,\n createGradientDecorations(doc, markOptions),\n );\n },\n apply(tr, value: DecorationSet) {\n const newDoc = tr.doc;\n if (tr.docChanged) {\n return DecorationSet.create(\n newDoc,\n createGradientDecorations(newDoc, markOptions),\n );\n }\n return value.map(tr.mapping, newDoc);\n },\n },\n props: {\n decorations(state: EditorState) {\n return (this as any).getState(state) as DecorationSet;\n },\n handleClickOn(view, pos, _node, _nodePos, event) {\n const decorationSet = (this as any).getState(\n view.state,\n ) as DecorationSet;\n const decorations = decorationSet.find(pos, pos + 1);\n\n for (const decoration of decorations) {\n const decorationWithAttrs = decoration as any;\n const templateName =\n decorationWithAttrs.type?.attrs?.[\"data-template\"];\n if (templateName) {\n if (markOptions.onTemplateClick) {\n markOptions.onTemplateClick(templateName, event as MouseEvent);\n }\n if (typeof window !== \"undefined\") {\n window.dispatchEvent(\n new CustomEvent(\"show-gradient-popover\", {\n detail: {\n templateName,\n target: event.target,\n },\n }),\n );\n }\n return true;\n }\n }\n return false;\n },\n },\n }),\n ];\n },\n});\n","/**\n * Canonical regex patterns for prompt editing tokens.\n */\nexport const TEMPLATE_REGEX = /{{\\s*([^}]+?)\\s*}}/g;\nexport const VARIABLE_REGEX = /(?<!\\{)\\{([^{}]+)\\}(?!\\})/g;\nexport const INSTRUCTION_REGEX = /__(.+?)__/g;\n\n// Backward-compatible camelCase aliases\nexport const templateRegex = TEMPLATE_REGEX;\nexport const variableRegex = VARIABLE_REGEX;\nexport const instructionRegex = INSTRUCTION_REGEX;\n\nexport type TokenType = \"template\" | \"variable\" | \"instruction\" | \"text\";\n\nexport interface Token {\n type: TokenType;\n raw: string;\n value: string;\n start: number;\n end: number;\n}\n\nexport interface TemplateVersion {\n id: string;\n version: string | number;\n body: string;\n createdAt?: any;\n [key: string]: any;\n}\n\nexport interface Template {\n id?: string;\n name: string;\n body?: string;\n latestVersion?: string | number;\n versions?: TemplateVersion[];\n color?: string;\n [key: string]: any;\n}\n\nexport interface ColorGradient {\n from: string;\n to: string;\n}\n","import { Extension } from \"@tiptap/core\";\nimport { Plugin } from \"@tiptap/pm/state\";\n\nexport interface SlashCommandMatchData {\n match: RegExpMatchArray;\n query: string;\n from: number;\n to: number;\n coords: { top: number; left: number; bottom: number; right: number };\n}\n\nexport interface SlashCommandsOptions {\n trigger?: string;\n onMatch?: (data: SlashCommandMatchData) => void;\n onClear?: () => void;\n containerId?: string;\n}\n\nexport const SlashCommands = Extension.create<SlashCommandsOptions>({\n name: \"slashCommands\",\n\n addOptions() {\n return {\n trigger: \"/\",\n onMatch: undefined,\n onClear: undefined,\n containerId: undefined,\n };\n },\n\n addProseMirrorPlugins() {\n const opts = this.options;\n\n return [\n new Plugin({\n view() {\n return {\n update(view) {\n const { state } = view;\n const { selection } = state;\n const { $from } = selection;\n\n if (!$from.parent.isTextblock) {\n opts.onClear?.();\n return;\n }\n\n const textBeforeCursor = $from.parent.textBetween(\n 0,\n $from.parentOffset,\n );\n\n const slashMatch = textBeforeCursor.match(\n /(?:^|\\s)\\/([a-zA-Z0-9_-]*)$/,\n );\n\n if (slashMatch) {\n const matchIndex = slashMatch.index ?? 0;\n const offsetInParent =\n matchIndex + (slashMatch[0].startsWith(\" \") ? 1 : 0);\n const matchFrom = $from.start() + offsetInParent;\n const matchTo = $from.pos;\n const coords = view.coordsAtPos($from.pos);\n\n let relativeCoords = {\n top: coords.top,\n left: coords.left,\n bottom: coords.bottom,\n right: coords.right,\n };\n\n if (opts.containerId && typeof document !== \"undefined\") {\n const container = document.getElementById(opts.containerId);\n if (container) {\n const rect = container.getBoundingClientRect();\n relativeCoords = {\n top: coords.bottom - rect.top + 5,\n left: coords.left - rect.left,\n bottom: coords.bottom - rect.top,\n right: coords.right - rect.left,\n };\n }\n }\n\n opts.onMatch?.({\n match: slashMatch,\n query: slashMatch[1] || \"\",\n from: matchFrom,\n to: matchTo,\n coords: relativeCoords,\n });\n } else {\n opts.onClear?.();\n }\n },\n };\n },\n }),\n ];\n },\n});\n","import { Extension } from \"@tiptap/core\";\nimport Suggestion, { SuggestionOptions } from \"@tiptap/suggestion\";\nimport { Template } from \"../grammar/tokens\";\n\nexport interface TemplateSuggestionsOptions {\n templates: Template[];\n char?: string;\n onSuggestion?: (props: {\n query: string;\n range: { from: number; to: number };\n clientRect?: (() => DOMRect | null) | null;\n items: Template[];\n command: (props: { name: string }) => void;\n }) => void;\n}\n\nexport const TemplateSuggestions = Extension.create<TemplateSuggestionsOptions>({\n name: \"templateSuggestions\",\n\n addOptions() {\n return {\n templates: [],\n char: \"{{\",\n onSuggestion: undefined,\n };\n },\n\n addProseMirrorPlugins() {\n const opts = this.options;\n\n const suggestionConfig: Omit<SuggestionOptions<Template>, \"editor\"> = {\n char: opts.char || \"{{\",\n items: ({ query }) => {\n const lower = query.toLowerCase();\n return (opts.templates || []).filter((t) =>\n t.name.toLowerCase().includes(lower),\n );\n },\n command: ({ editor, range, props }) => {\n editor\n .chain()\n .focus()\n .deleteRange(range)\n .insertContent(`{{${props.name}}}`)\n .run();\n },\n render: () => {\n return {\n onStart: (props) => {\n opts.onSuggestion?.(props as any);\n },\n onUpdate: (props) => {\n opts.onSuggestion?.(props as any);\n },\n onExit: () => {\n opts.onSuggestion?.({\n query: \"\",\n range: { from: 0, to: 0 },\n items: [],\n command: () => {},\n });\n },\n };\n },\n };\n\n const SuggestionFn =\n typeof Suggestion === \"function\"\n ? Suggestion\n : (Suggestion as any)?.default || (Suggestion as any)?.Suggestion;\n\n return [\n SuggestionFn({\n editor: this.editor,\n ...suggestionConfig,\n }),\n ];\n },\n});\n","import { Node, mergeAttributes } from \"@tiptap/core\";\n\nexport const LoadingNode = Node.create({\n name: \"loadingNode\",\n group: \"inline\",\n inline: true,\n selectable: true,\n atom: true,\n\n addAttributes() {\n return {\n id: {\n default: null,\n parseHTML: (element) => element.getAttribute(\"data-id\"),\n renderHTML: (attributes) => {\n if (!attributes.id) return {};\n return { \"data-id\": attributes.id };\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'span[data-type=\"loading\"]',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n \"span\",\n mergeAttributes(HTMLAttributes, {\n \"data-type\": \"loading\",\n class: \"inline-flex items-center px-1.5 py-0.5 text-xs text-muted-foreground animate-pulse\",\n }),\n \"⏳\",\n ];\n },\n});\n","import { Extension, textInputRule } from \"@tiptap/core\";\n\nexport const SmilieReplacer = Extension.create({\n name: \"smilieReplacer\",\n\n addInputRules() {\n return [\n textInputRule({ find: /-___- $/, replace: \"😑 \" }),\n textInputRule({ find: /:'-\\) $/, replace: \"😂 \" }),\n textInputRule({ find: /':-\\) $/, replace: \"😅 \" }),\n textInputRule({ find: /':-D $/, replace: \"😅 \" }),\n textInputRule({ find: />:-\\) $/, replace: \"😆 \" }),\n textInputRule({ find: /-__- $/, replace: \"😑 \" }),\n textInputRule({ find: /':-\\( $/, replace: \"😓 \" }),\n textInputRule({ find: /:'-\\( $/, replace: \"😢 \" }),\n textInputRule({ find: />:-\\( $/, replace: \"😠 \" }),\n textInputRule({ find: /O:-\\) $/, replace: \"😇 \" }),\n textInputRule({ find: /:'\\) $/, replace: \"😂 \" }),\n textInputRule({ find: /:-D $/, replace: \"😃 \" }),\n textInputRule({ find: /':\\) $/, replace: \"😅 \" }),\n textInputRule({ find: /;-\\) $/, replace: \"😉 \" }),\n textInputRule({ find: /B-\\) $/, replace: \"😎 \" }),\n textInputRule({ find: /:-\\* $/, replace: \"😘 \" }),\n textInputRule({ find: /:-\\) $/, replace: \"🙂 \" }),\n textInputRule({ find: /-_- $/, replace: \"😑 \" }),\n textInputRule({ find: /:-O $/, replace: \"😮 \" }),\n textInputRule({ find: /:-P $/, replace: \"😛 \" }),\n textInputRule({ find: /:-p $/, replace: \"😛 \" }),\n textInputRule({ find: /:-\\/ $/, replace: \"😕 \" }),\n textInputRule({ find: /:-\\( $/, replace: \"😞 \" }),\n textInputRule({ find: /:'\\( $/, replace: \"😢 \" }),\n textInputRule({ find: /:D $/, replace: \"😃 \" }),\n textInputRule({ find: /=D $/, replace: \"😃 \" }),\n textInputRule({ find: /;\\) $/, replace: \"😉 \" }),\n textInputRule({ find: /B\\) $/, replace: \"😎 \" }),\n textInputRule({ find: /:\\) $/, replace: \"🙂 \" }),\n textInputRule({ find: /=\\) $/, replace: \"🙂 \" }),\n textInputRule({ find: /:O $/, replace: \"😮 \" }),\n textInputRule({ find: /:P $/, replace: \"😛 \" }),\n textInputRule({ find: /:p $/, replace: \"😛 \" }),\n textInputRule({ find: /:\\/ $/, replace: \"😕 \" }),\n textInputRule({ find: /:\\( $/, replace: \"😞 \" }),\n textInputRule({ find: /<3 $/, replace: \"❤️ \" }),\n textInputRule({ find: /<\\/3 $/, replace: \"💔 \" }),\n textInputRule({ find: /\\/shrug $/, replace: \"¯\\\\_(ツ)_/¯ \" }),\n ];\n },\n});\n","import { Extension } from \"@tiptap/core\";\nimport { Plugin } from \"@tiptap/pm/state\";\nimport { Decoration, DecorationSet } from \"@tiptap/pm/view\";\nimport type { Node as ProsemirrorNode } from \"@tiptap/pm/model\";\n\nexport function findHexColors(doc: ProsemirrorNode): DecorationSet {\n const hexColorRegex = /(#[0-9a-fA-F]{3,8})\\b/g;\n const decorations: Decoration[] = [];\n\n doc.descendants((node, position) => {\n if (!node.text) return;\n\n let match: RegExpExecArray | null;\n while ((match = hexColorRegex.exec(node.text)) !== null) {\n const color = match[0];\n const from = position + match.index;\n const to = from + color.length;\n\n decorations.push(\n Decoration.inline(from, to, {\n class: \"color-highlight px-1 py-0.5 rounded text-xs font-mono border\",\n style: `--color: ${color}; background-color: ${color}20; border-color: ${color}; color: ${color};`,\n }),\n );\n }\n });\n\n return DecorationSet.create(doc, decorations);\n}\n\nexport const ColorHighlighter = Extension.create({\n name: \"colorHighlighter\",\n\n addProseMirrorPlugins() {\n return [\n new Plugin({\n state: {\n init(_, { doc }) {\n return findHexColors(doc);\n },\n apply(transaction, oldState) {\n return transaction.docChanged ? findHexColors(transaction.doc) : oldState;\n },\n },\n props: {\n decorations(state) {\n return (this as any).getState(state);\n },\n },\n }),\n ];\n },\n});\n","import { Extension } from \"@tiptap/core\";\nimport \"@tiptap/extension-text-style\";\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n fontSize: {\n setFontSize: (size: string) => ReturnType;\n unsetFontSize: () => ReturnType;\n };\n }\n}\n\nexport const FontSize = Extension.create({\n name: \"fontSize\",\n\n addOptions() {\n return {\n types: [\"textStyle\"],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n fontSize: {\n default: null,\n parseHTML: (element) =>\n element.style.fontSize.replace(/['\"]+/g, \"\"),\n renderHTML: (attributes) => {\n if (!attributes.fontSize) {\n return {};\n }\n return {\n style: `font-size: ${attributes.fontSize}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setFontSize:\n (fontSize: string) =>\n ({ chain }) =>\n chain().setMark(\"textStyle\", { fontSize }).run(),\n unsetFontSize:\n () =>\n ({ chain }) =>\n chain()\n .setMark(\"textStyle\", { fontSize: null })\n .removeEmptyTextStyle()\n .run(),\n };\n },\n});\n\nexport default FontSize;\n","import { wrappingInputRule, markInputRule, type Extensions } from \"@tiptap/core\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport Color from \"@tiptap/extension-color\";\nimport Highlight from \"@tiptap/extension-highlight\";\nimport Link from \"@tiptap/extension-link\";\nimport TaskList from \"@tiptap/extension-task-list\";\nimport TaskItem from \"@tiptap/extension-task-item\";\nimport TextAlign from \"@tiptap/extension-text-align\";\nimport * as _TextStyle from \"@tiptap/extension-text-style\";\nconst TextStyle = (_TextStyle as any).TextStyle || (_TextStyle as any).default || _TextStyle;\nimport Typography from \"@tiptap/extension-typography\";\nimport Underline from \"@tiptap/extension-underline\";\nimport Placeholder from \"@tiptap/extension-placeholder\";\nimport CharacterCount from \"@tiptap/extension-character-count\";\n\nimport { SmilieReplacer } from \"./SmilieReplacer\";\nimport { ColorHighlighter } from \"./ColorHighlighter\";\nimport { FontSize } from \"./FontSize\";\nimport { Mention, type MentionOptions } from \"./mention\";\n\nexport interface RichTextPresetOptions {\n placeholder?: string | ((props: { node: any }) => string);\n characterLimit?: number;\n openLinksOnClick?: boolean;\n enableSmilies?: boolean;\n enableColorHighlighter?: boolean;\n headingLevels?: (1 | 2 | 3 | 4 | 5 | 6)[];\n mention?: MentionOptions | boolean;\n}\n\n/**\n * Creates a standard rich-text extensions bundle with full formatting support.\n */\nexport function createRichTextPreset(\n options: RichTextPresetOptions = {},\n): Extensions {\n const {\n placeholder = \"Start typing...\",\n characterLimit,\n openLinksOnClick = false,\n enableSmilies = true,\n enableColorHighlighter = true,\n headingLevels = [1, 2, 3, 4],\n } = options;\n\n const extensions: Extensions = [\n StarterKit.configure({\n orderedList: {\n HTMLAttributes: {\n class: \"list-decimal pl-4\",\n },\n },\n bulletList: {\n HTMLAttributes: {\n class: \"list-disc pl-4\",\n },\n },\n heading: {\n levels: headingLevels,\n HTMLAttributes: {\n class: \"font-bold tracking-tight\",\n },\n },\n }),\n TextStyle,\n Color,\n Highlight.configure({ multicolor: true }),\n Underline,\n Typography,\n TextAlign.configure({\n types: [\"heading\", \"paragraph\"],\n }),\n Link.extend({\n addInputRules() {\n return [\n markInputRule({\n find: /(?:^|\\s)\\[([^\\]]+)\\]\\(([^)]+)\\)$/,\n type: this.type,\n getAttributes: (match) => ({\n href: match[2],\n }),\n }),\n ];\n },\n }).configure({\n openOnClick: openLinksOnClick,\n autolink: true,\n defaultProtocol: \"https\",\n HTMLAttributes: {\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n class: \"text-blue-500 underline underline-offset-2\",\n },\n }),\n TaskList,\n TaskItem.extend({\n addInputRules() {\n return [\n wrappingInputRule({\n find: /^\\s*(\\[([ |x])?\\])\\s$/i,\n type: this.type,\n getAttributes: (match) => ({\n checked: match[2]?.toLowerCase() === \"x\",\n }),\n }),\n ];\n },\n }).configure({\n nested: true,\n }),\n FontSize,\n Placeholder.configure({\n emptyEditorClass: \"is-empty\",\n placeholder:\n typeof placeholder === \"function\"\n ? placeholder\n : () => placeholder,\n }),\n ];\n\n if (characterLimit) {\n extensions.push(\n CharacterCount.configure({\n limit: characterLimit,\n }),\n );\n }\n\n if (enableSmilies) {\n extensions.push(SmilieReplacer);\n }\n\n if (enableColorHighlighter) {\n extensions.push(ColorHighlighter);\n }\n\n if (options.mention) {\n const mentionConfig = typeof options.mention === \"object\" ? options.mention : {};\n extensions.push(\n Mention.configure({\n HTMLAttributes: {\n class: \"pixerate-mention-node\",\n ...(mentionConfig.HTMLAttributes || {}),\n },\n ...mentionConfig,\n }),\n );\n }\n\n return extensions;\n}\n","import MentionExtension, {\n type MentionOptions as TipTapMentionOptions,\n} from \"@tiptap/extension-mention\";\nimport type { SuggestionOptions } from \"@tiptap/suggestion\";\n\nexport interface MentionEntity {\n id: string;\n label: string;\n type?: string;\n avatarUrl?: string;\n color?: string;\n [key: string]: any;\n}\n\nexport interface MentionOptions extends Partial<TipTapMentionOptions> {\n HTMLAttributes?: Record<string, any>;\n suggestion?: Partial<SuggestionOptions<MentionEntity>>;\n}\n\n/**\n * First-class native Mention extension for @pixerate/editor.\n * Creates atomic inline <span data-type=\"mention\"> nodes with full suggestion support.\n */\nexport const Mention = MentionExtension.extend({\n addAttributes() {\n return {\n ...this.parent?.(),\n type: {\n default: null,\n parseHTML: (element: HTMLElement) =>\n element.getAttribute(\"data-type-name\") ||\n element.getAttribute(\"data-entity-type\"),\n renderHTML: (attributes: Record<string, any>) => {\n if (!attributes.type) return {};\n return { \"data-type-name\": attributes.type };\n },\n },\n avatarUrl: {\n default: null,\n parseHTML: (element: HTMLElement) => element.getAttribute(\"data-avatar-url\"),\n renderHTML: (attributes: Record<string, any>) => {\n if (!attributes.avatarUrl) return {};\n return { \"data-avatar-url\": attributes.avatarUrl };\n },\n },\n color: {\n default: null,\n parseHTML: (element: HTMLElement) => element.getAttribute(\"data-color\"),\n renderHTML: (attributes: Record<string, any>) => {\n if (!attributes.color) return {};\n return { \"data-color\": attributes.color };\n },\n },\n };\n },\n});\n\n/**\n * Helper to configure the Mention extension with preset defaults.\n */\nexport function createMentionExtension(options: Partial<MentionOptions> = {}) {\n const { HTMLAttributes = {}, ...rest } = options;\n return Mention.configure({\n HTMLAttributes: {\n class: \"pixerate-mention-node\",\n ...HTMLAttributes,\n },\n ...rest,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAqB;AACrB,mBAAuB;AACvB,kBAA0C;;;ACCnC,IAAM,iBAAiB;AACvB,IAAM,iBAAiB;AACvB,IAAM,oBAAoB;;;ADSjC,IAAM,4BAA4B,CAChC,KACA,YACiB;AACjB,QAAM,cAA4B,CAAC;AACnC,QAAM,QAAQ,QAAQ,SAAS;AAC/B,QAAM,aAAa,QAAQ,gBACvB,QAAQ,yBAAyB,MAC/B,QAAQ,gBACR,IAAI,IAAI,QAAQ,aAAa,IAC/B;AAEJ,MAAI,YAAY,CAAC,MAAM,QAAQ;AAC7B,QAAI,KAAK,QAAQ;AACf,YAAM,OAAO,KAAK,QAAQ;AAC1B,UAAI;AAGJ,YAAM,YAAY,IAAI,OAAO,eAAe,QAAQ,eAAe,KAAK;AACxE,cAAQ,QAAQ,UAAU,KAAK,IAAI,OAAO,MAAM;AAC9C,cAAM,eAAe,MAAM,CAAC,EAAE,KAAK;AACnC,cAAM,SAAS,QAAQ,kBAAkB,IAAI,YAAY;AAEzD,YAAI,QAAQ;AACV,gBAAM,QAAQ,MAAM,MAAM;AAC1B,gBAAM,MAAM,QAAQ,MAAM,CAAC,EAAE;AAC7B,gBAAM,EAAE,MAAM,WAAW,IAAI,QAAQ,IAAI;AAEzC,gBAAM,QAAQ,cACZ,QAAQ,GACV,oBAAoB,SAAS,iBAAiB,OAAO;AAErD,sBAAY;AAAA,YACV,uBAAW,OAAO,OAAO,KAAK;AAAA,cAC5B,OACE;AAAA,cACF;AAAA,cACA,iBAAiB;AAAA,YACnB,CAAC;AAAA,UACH;AAAA,QACF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AA,IACD;AAAA,IACA,6BAAAC,QAAY,UAAU;AAAA,MACpB,kBAAkB;AAAA,MAClB,aACE,OAAO,gBAAgB,aACnB,cACA,MAAM;AAAA,IACd,CAAC;AAAA,EACH;AAEA,MAAI,gBAAgB;AAClB,eAAW;AAAA,MACT,iCAAAC,QAAe,UAAU;AAAA,QACvB,OAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,eAAe;AACjB,eAAW,KAAK,cAAc;AAAA,EAChC;AAEA,MAAI,wBAAwB;AAC1B,eAAW,KAAK,gBAAgB;AAAA,EAClC;AAEA,MAAI,QAAQ,SAAS;AACnB,UAAM,gBAAgB,OAAO,QAAQ,YAAY,WAAW,QAAQ,UAAU,CAAC;AAC/E,eAAW;AAAA,MACT,QAAQ,UAAU;AAAA,QAChB,gBAAgB;AAAA,UACd,OAAO;AAAA,UACP,GAAI,cAAc,kBAAkB,CAAC;AAAA,QACvC;AAAA,QACA,GAAG;AAAA,MACL,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AACT;","names":["import_core","import_state","import_core","Suggestion","import_core","import_core","import_core","import_state","import_view","import_core","import_core","MentionExtension","TextStyle","StarterKit","Color","Highlight","Underline","Typography","TextAlign","Link","TaskList","TaskItem","Placeholder","CharacterCount"]}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import * as _tiptap_core from '@tiptap/core';
|
|
1
2
|
import { Mark, Extension, Node, Extensions } from '@tiptap/core';
|
|
2
3
|
import { C as ColorGradient, b as Template } from '../tokens-7kRTEtPb.cjs';
|
|
3
4
|
import { DecorationSet } from '@tiptap/pm/view';
|
|
4
5
|
import { Node as Node$1 } from '@tiptap/pm/model';
|
|
6
|
+
import * as _tiptap_extension_mention from '@tiptap/extension-mention';
|
|
7
|
+
import { MentionOptions as MentionOptions$1 } from '@tiptap/extension-mention';
|
|
8
|
+
import { SuggestionOptions } from '@tiptap/suggestion';
|
|
5
9
|
|
|
6
10
|
interface GradientTextOptions {
|
|
7
11
|
templateColorMap: Map<string, ColorGradient>;
|
|
@@ -66,6 +70,28 @@ declare module "@tiptap/core" {
|
|
|
66
70
|
}
|
|
67
71
|
declare const FontSize: Extension<any, any>;
|
|
68
72
|
|
|
73
|
+
interface MentionEntity {
|
|
74
|
+
id: string;
|
|
75
|
+
label: string;
|
|
76
|
+
type?: string;
|
|
77
|
+
avatarUrl?: string;
|
|
78
|
+
color?: string;
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
}
|
|
81
|
+
interface MentionOptions extends Partial<MentionOptions$1> {
|
|
82
|
+
HTMLAttributes?: Record<string, any>;
|
|
83
|
+
suggestion?: Partial<SuggestionOptions<MentionEntity>>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* First-class native Mention extension for @pixerate/editor.
|
|
87
|
+
* Creates atomic inline <span data-type="mention"> nodes with full suggestion support.
|
|
88
|
+
*/
|
|
89
|
+
declare const Mention: _tiptap_core.Node<MentionOptions$1<any, _tiptap_extension_mention.MentionNodeAttrs>, any>;
|
|
90
|
+
/**
|
|
91
|
+
* Helper to configure the Mention extension with preset defaults.
|
|
92
|
+
*/
|
|
93
|
+
declare function createMentionExtension(options?: Partial<MentionOptions>): _tiptap_core.Node<MentionOptions$1<any, _tiptap_extension_mention.MentionNodeAttrs>, any>;
|
|
94
|
+
|
|
69
95
|
interface RichTextPresetOptions {
|
|
70
96
|
placeholder?: string | ((props: {
|
|
71
97
|
node: any;
|
|
@@ -75,10 +101,11 @@ interface RichTextPresetOptions {
|
|
|
75
101
|
enableSmilies?: boolean;
|
|
76
102
|
enableColorHighlighter?: boolean;
|
|
77
103
|
headingLevels?: (1 | 2 | 3 | 4 | 5 | 6)[];
|
|
104
|
+
mention?: MentionOptions | boolean;
|
|
78
105
|
}
|
|
79
106
|
/**
|
|
80
107
|
* Creates a standard rich-text extensions bundle with full formatting support.
|
|
81
108
|
*/
|
|
82
109
|
declare function createRichTextPreset(options?: RichTextPresetOptions): Extensions;
|
|
83
110
|
|
|
84
|
-
export { ColorHighlighter, FontSize, GradientText, type GradientTextOptions, LoadingNode, type RichTextPresetOptions, type SlashCommandMatchData, SlashCommands, type SlashCommandsOptions, SmilieReplacer, TemplateSuggestions, type TemplateSuggestionsOptions, createRichTextPreset, findHexColors };
|
|
111
|
+
export { ColorHighlighter, FontSize, GradientText, type GradientTextOptions, LoadingNode, Mention, type MentionEntity, type MentionOptions, type RichTextPresetOptions, type SlashCommandMatchData, SlashCommands, type SlashCommandsOptions, SmilieReplacer, TemplateSuggestions, type TemplateSuggestionsOptions, createMentionExtension, createRichTextPreset, findHexColors };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import * as _tiptap_core from '@tiptap/core';
|
|
1
2
|
import { Mark, Extension, Node, Extensions } from '@tiptap/core';
|
|
2
3
|
import { C as ColorGradient, b as Template } from '../tokens-7kRTEtPb.js';
|
|
3
4
|
import { DecorationSet } from '@tiptap/pm/view';
|
|
4
5
|
import { Node as Node$1 } from '@tiptap/pm/model';
|
|
6
|
+
import * as _tiptap_extension_mention from '@tiptap/extension-mention';
|
|
7
|
+
import { MentionOptions as MentionOptions$1 } from '@tiptap/extension-mention';
|
|
8
|
+
import { SuggestionOptions } from '@tiptap/suggestion';
|
|
5
9
|
|
|
6
10
|
interface GradientTextOptions {
|
|
7
11
|
templateColorMap: Map<string, ColorGradient>;
|
|
@@ -66,6 +70,28 @@ declare module "@tiptap/core" {
|
|
|
66
70
|
}
|
|
67
71
|
declare const FontSize: Extension<any, any>;
|
|
68
72
|
|
|
73
|
+
interface MentionEntity {
|
|
74
|
+
id: string;
|
|
75
|
+
label: string;
|
|
76
|
+
type?: string;
|
|
77
|
+
avatarUrl?: string;
|
|
78
|
+
color?: string;
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
}
|
|
81
|
+
interface MentionOptions extends Partial<MentionOptions$1> {
|
|
82
|
+
HTMLAttributes?: Record<string, any>;
|
|
83
|
+
suggestion?: Partial<SuggestionOptions<MentionEntity>>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* First-class native Mention extension for @pixerate/editor.
|
|
87
|
+
* Creates atomic inline <span data-type="mention"> nodes with full suggestion support.
|
|
88
|
+
*/
|
|
89
|
+
declare const Mention: _tiptap_core.Node<MentionOptions$1<any, _tiptap_extension_mention.MentionNodeAttrs>, any>;
|
|
90
|
+
/**
|
|
91
|
+
* Helper to configure the Mention extension with preset defaults.
|
|
92
|
+
*/
|
|
93
|
+
declare function createMentionExtension(options?: Partial<MentionOptions>): _tiptap_core.Node<MentionOptions$1<any, _tiptap_extension_mention.MentionNodeAttrs>, any>;
|
|
94
|
+
|
|
69
95
|
interface RichTextPresetOptions {
|
|
70
96
|
placeholder?: string | ((props: {
|
|
71
97
|
node: any;
|
|
@@ -75,10 +101,11 @@ interface RichTextPresetOptions {
|
|
|
75
101
|
enableSmilies?: boolean;
|
|
76
102
|
enableColorHighlighter?: boolean;
|
|
77
103
|
headingLevels?: (1 | 2 | 3 | 4 | 5 | 6)[];
|
|
104
|
+
mention?: MentionOptions | boolean;
|
|
78
105
|
}
|
|
79
106
|
/**
|
|
80
107
|
* Creates a standard rich-text extensions bundle with full formatting support.
|
|
81
108
|
*/
|
|
82
109
|
declare function createRichTextPreset(options?: RichTextPresetOptions): Extensions;
|
|
83
110
|
|
|
84
|
-
export { ColorHighlighter, FontSize, GradientText, type GradientTextOptions, LoadingNode, type RichTextPresetOptions, type SlashCommandMatchData, SlashCommands, type SlashCommandsOptions, SmilieReplacer, TemplateSuggestions, type TemplateSuggestionsOptions, createRichTextPreset, findHexColors };
|
|
111
|
+
export { ColorHighlighter, FontSize, GradientText, type GradientTextOptions, LoadingNode, Mention, type MentionEntity, type MentionOptions, type RichTextPresetOptions, type SlashCommandMatchData, SlashCommands, type SlashCommandsOptions, SmilieReplacer, TemplateSuggestions, type TemplateSuggestionsOptions, createMentionExtension, createRichTextPreset, findHexColors };
|
package/dist/extensions/index.js
CHANGED
|
@@ -475,6 +475,7 @@ var FontSize = Extension5.create({
|
|
|
475
475
|
});
|
|
476
476
|
|
|
477
477
|
// src/extensions/rich-text-preset.ts
|
|
478
|
+
import { wrappingInputRule, markInputRule } from "@tiptap/core";
|
|
478
479
|
import StarterKit from "@tiptap/starter-kit";
|
|
479
480
|
import Color from "@tiptap/extension-color";
|
|
480
481
|
import Highlight from "@tiptap/extension-highlight";
|
|
@@ -487,6 +488,52 @@ import Typography from "@tiptap/extension-typography";
|
|
|
487
488
|
import Underline from "@tiptap/extension-underline";
|
|
488
489
|
import Placeholder from "@tiptap/extension-placeholder";
|
|
489
490
|
import CharacterCount from "@tiptap/extension-character-count";
|
|
491
|
+
|
|
492
|
+
// src/extensions/mention.ts
|
|
493
|
+
import MentionExtension from "@tiptap/extension-mention";
|
|
494
|
+
var Mention = MentionExtension.extend({
|
|
495
|
+
addAttributes() {
|
|
496
|
+
return {
|
|
497
|
+
...this.parent?.(),
|
|
498
|
+
type: {
|
|
499
|
+
default: null,
|
|
500
|
+
parseHTML: (element) => element.getAttribute("data-type-name") || element.getAttribute("data-entity-type"),
|
|
501
|
+
renderHTML: (attributes) => {
|
|
502
|
+
if (!attributes.type) return {};
|
|
503
|
+
return { "data-type-name": attributes.type };
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
avatarUrl: {
|
|
507
|
+
default: null,
|
|
508
|
+
parseHTML: (element) => element.getAttribute("data-avatar-url"),
|
|
509
|
+
renderHTML: (attributes) => {
|
|
510
|
+
if (!attributes.avatarUrl) return {};
|
|
511
|
+
return { "data-avatar-url": attributes.avatarUrl };
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
color: {
|
|
515
|
+
default: null,
|
|
516
|
+
parseHTML: (element) => element.getAttribute("data-color"),
|
|
517
|
+
renderHTML: (attributes) => {
|
|
518
|
+
if (!attributes.color) return {};
|
|
519
|
+
return { "data-color": attributes.color };
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
function createMentionExtension(options = {}) {
|
|
526
|
+
const { HTMLAttributes = {}, ...rest } = options;
|
|
527
|
+
return Mention.configure({
|
|
528
|
+
HTMLAttributes: {
|
|
529
|
+
class: "pixerate-mention-node",
|
|
530
|
+
...HTMLAttributes
|
|
531
|
+
},
|
|
532
|
+
...rest
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
// src/extensions/rich-text-preset.ts
|
|
490
537
|
var TextStyle2 = _TextStyle.TextStyle || _TextStyle.default || _TextStyle;
|
|
491
538
|
function createRichTextPreset(options = {}) {
|
|
492
539
|
const {
|
|
@@ -524,7 +571,19 @@ function createRichTextPreset(options = {}) {
|
|
|
524
571
|
TextAlign.configure({
|
|
525
572
|
types: ["heading", "paragraph"]
|
|
526
573
|
}),
|
|
527
|
-
Link.
|
|
574
|
+
Link.extend({
|
|
575
|
+
addInputRules() {
|
|
576
|
+
return [
|
|
577
|
+
markInputRule({
|
|
578
|
+
find: /(?:^|\s)\[([^\]]+)\]\(([^)]+)\)$/,
|
|
579
|
+
type: this.type,
|
|
580
|
+
getAttributes: (match) => ({
|
|
581
|
+
href: match[2]
|
|
582
|
+
})
|
|
583
|
+
})
|
|
584
|
+
];
|
|
585
|
+
}
|
|
586
|
+
}).configure({
|
|
528
587
|
openOnClick: openLinksOnClick,
|
|
529
588
|
autolink: true,
|
|
530
589
|
defaultProtocol: "https",
|
|
@@ -535,7 +594,19 @@ function createRichTextPreset(options = {}) {
|
|
|
535
594
|
}
|
|
536
595
|
}),
|
|
537
596
|
TaskList,
|
|
538
|
-
TaskItem.
|
|
597
|
+
TaskItem.extend({
|
|
598
|
+
addInputRules() {
|
|
599
|
+
return [
|
|
600
|
+
wrappingInputRule({
|
|
601
|
+
find: /^\s*(\[([ |x])?\])\s$/i,
|
|
602
|
+
type: this.type,
|
|
603
|
+
getAttributes: (match) => ({
|
|
604
|
+
checked: match[2]?.toLowerCase() === "x"
|
|
605
|
+
})
|
|
606
|
+
})
|
|
607
|
+
];
|
|
608
|
+
}
|
|
609
|
+
}).configure({
|
|
539
610
|
nested: true
|
|
540
611
|
}),
|
|
541
612
|
FontSize,
|
|
@@ -557,6 +628,18 @@ function createRichTextPreset(options = {}) {
|
|
|
557
628
|
if (enableColorHighlighter) {
|
|
558
629
|
extensions.push(ColorHighlighter);
|
|
559
630
|
}
|
|
631
|
+
if (options.mention) {
|
|
632
|
+
const mentionConfig = typeof options.mention === "object" ? options.mention : {};
|
|
633
|
+
extensions.push(
|
|
634
|
+
Mention.configure({
|
|
635
|
+
HTMLAttributes: {
|
|
636
|
+
class: "pixerate-mention-node",
|
|
637
|
+
...mentionConfig.HTMLAttributes || {}
|
|
638
|
+
},
|
|
639
|
+
...mentionConfig
|
|
640
|
+
})
|
|
641
|
+
);
|
|
642
|
+
}
|
|
560
643
|
return extensions;
|
|
561
644
|
}
|
|
562
645
|
export {
|
|
@@ -564,9 +647,11 @@ export {
|
|
|
564
647
|
FontSize,
|
|
565
648
|
GradientText,
|
|
566
649
|
LoadingNode,
|
|
650
|
+
Mention,
|
|
567
651
|
SlashCommands,
|
|
568
652
|
SmilieReplacer,
|
|
569
653
|
TemplateSuggestions,
|
|
654
|
+
createMentionExtension,
|
|
570
655
|
createRichTextPreset,
|
|
571
656
|
findHexColors
|
|
572
657
|
};
|