payload-richtext-tiptap 0.0.159 → 0.0.161
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/src/fields/TiptapEditor/extensions/Iframe/IframeEmbed.d.ts +2 -7
- package/dist/src/fields/TiptapEditor/extensions/Iframe/IframeEmbed.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/Iframe/IframeEmbed.js +20 -7
- package/dist/src/fields/TiptapEditor/extensions/Iframe/IframeEmbed.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/Iframe/iframe.d.ts +2 -2
- package/dist/src/fields/TiptapEditor/extensions/Iframe/iframe.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/Iframe/iframe.js +42 -30
- package/dist/src/fields/TiptapEditor/extensions/Iframe/iframe.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/Paragraph/Paragraph.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/Paragraph/Paragraph.js +27 -4
- package/dist/src/fields/TiptapEditor/extensions/Paragraph/Paragraph.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/PasteHandler/PasteHandler.d.ts +4 -0
- package/dist/src/fields/TiptapEditor/extensions/PasteHandler/PasteHandler.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/PasteHandler/PasteHandler.js +242 -0
- package/dist/src/fields/TiptapEditor/extensions/PasteHandler/PasteHandler.js.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/PasteHandler/index.d.ts +2 -0
- package/dist/src/fields/TiptapEditor/extensions/PasteHandler/index.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/PasteHandler/index.js +3 -0
- package/dist/src/fields/TiptapEditor/extensions/PasteHandler/index.js.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/groups.d.ts +1 -1
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/groups.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/groups.js +108 -84
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/groups.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/Table/Table.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/Table/Table.js +2 -1
- package/dist/src/fields/TiptapEditor/extensions/Table/Table.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/extension-kit.d.ts +3 -3
- package/dist/src/fields/TiptapEditor/extensions/extension-kit.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/extension-kit.js +29 -22
- package/dist/src/fields/TiptapEditor/extensions/extension-kit.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/index.d.ts +50 -49
- package/dist/src/fields/TiptapEditor/extensions/index.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/index.js +50 -49
- package/dist/src/fields/TiptapEditor/extensions/index.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/IFrameServerside.d.ts +2 -2
- package/dist/src/fields/TiptapEditor/extensions/serverside/IFrameServerside.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/IFrameServerside.js +26 -8
- package/dist/src/fields/TiptapEditor/extensions/serverside/IFrameServerside.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/TableServerside.d.ts +10 -0
- package/dist/src/fields/TiptapEditor/extensions/serverside/TableServerside.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/serverside/TableServerside.js +90 -0
- package/dist/src/fields/TiptapEditor/extensions/serverside/TableServerside.js.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/serverside/index.d.ts +15 -13
- package/dist/src/fields/TiptapEditor/extensions/serverside/index.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/index.js +15 -13
- package/dist/src/fields/TiptapEditor/extensions/serverside/index.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/BlockEditor/BlockEditor.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/BlockEditor/BlockEditor.js +9 -0
- package/dist/src/fields/TiptapEditor/features/BlockEditor/BlockEditor.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/IframeLinkEditorPanel/IframeLinkEditorPanel.d.ts +2 -2
- package/dist/src/fields/TiptapEditor/features/panels/IframeLinkEditorPanel/IframeLinkEditorPanel.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/IframeLinkEditorPanel/IframeLinkEditorPanel.js +20 -18
- package/dist/src/fields/TiptapEditor/features/panels/IframeLinkEditorPanel/IframeLinkEditorPanel.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashCommandTriggerButton.d.ts +4 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashCommandTriggerButton.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashCommandTriggerButton.js +32 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashCommandTriggerButton.js.map +1 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashDropdownMenu.d.ts +4 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashDropdownMenu.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashDropdownMenu.js +70 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashDropdownMenu.js.map +1 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashMenuList.d.ts +10 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashMenuList.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashMenuList.js +249 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashMenuList.js.map +1 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SuggestionMenu.d.ts +15 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SuggestionMenu.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SuggestionMenu.js +291 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SuggestionMenu.js.map +1 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/index.d.ts +7 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/index.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/index.js +7 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/index.js.map +1 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/types.d.ts +28 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/types.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/types.js +3 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/types.js.map +1 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/utils.d.ts +6 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/utils.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/utils.js +222 -0
- package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/utils.js.map +1 -0
- package/dist/src/fields/TiptapEditor/lib/utils/updateImageUrl.d.ts +2 -0
- package/dist/src/fields/TiptapEditor/lib/utils/updateImageUrl.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/lib/utils/updateImageUrl.js +17 -0
- package/dist/src/fields/TiptapEditor/lib/utils/updateImageUrl.js.map +1 -0
- package/dist/src/mobile.css +1 -1
- package/dist/src/styles.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/PasteHandler/PasteHandler.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\r\nimport { Plugin, PluginKey } from '@tiptap/pm/state'\r\n\r\n/**\r\n * Checks if the HTML contains a table element\r\n */\r\nfunction containsTable(html: string): boolean {\r\n return /<table[\\s>]/i.test(html)\r\n}\r\n\r\n/**\r\n * Checks if the HTML contains an iframe element\r\n */\r\nfunction containsIframe(html: string): boolean {\r\n return /<iframe[\\s>]/i.test(html)\r\n}\r\n\r\n/**\r\n * Extracts iframe attributes from HTML string\r\n */\r\nfunction extractIframeAttributes(html: string): Record<string, string> | null {\r\n const parser = new DOMParser()\r\n const doc = parser.parseFromString(html, 'text/html')\r\n const iframe = doc.querySelector('iframe')\r\n\r\n if (!iframe) return null\r\n\r\n const attributes: Record<string, string> = {}\r\n for (const attr of iframe.getAttributeNames()) {\r\n const value = iframe.getAttribute(attr)\r\n if (value !== null) {\r\n attributes[attr] = value\r\n }\r\n }\r\n\r\n return attributes\r\n}\r\n\r\n/**\r\n * Checks if text is a Flourish, Datawrapper, or similar embed URL\r\n */\r\nfunction isEmbedUrl(text: string): boolean {\r\n const embedPatterns = [\r\n /flourish\\.studio/i,\r\n /datawrapper\\.dwcdn\\.net/i,\r\n /infogram\\.com/i,\r\n /public\\.tableau\\.com/i,\r\n /plotly\\.com/i,\r\n /app\\.powerbi\\.com/i,\r\n ]\r\n return embedPatterns.some((pattern) => pattern.test(text))\r\n}\r\n\r\n/**\r\n * Parses HTML table string and converts it to TipTap table JSON format\r\n */\r\nfunction parseHtmlTableToJson(html: string): Record<string, unknown> | null {\r\n const parser = new DOMParser()\r\n const doc = parser.parseFromString(html, 'text/html')\r\n const table = doc.querySelector('table')\r\n\r\n if (!table) return null\r\n\r\n const rows: Record<string, unknown>[] = []\r\n const tableRows = table.querySelectorAll('tr')\r\n\r\n tableRows.forEach((tr, rowIndex) => {\r\n const cells: Record<string, unknown>[] = []\r\n const tableCells = tr.querySelectorAll('td, th')\r\n\r\n tableCells.forEach((cell) => {\r\n const isHeader = cell.tagName.toLowerCase() === 'th'\r\n const cellText = cell.textContent?.trim() || ''\r\n\r\n // Get colspan and rowspan attributes\r\n const colspan = parseInt(cell.getAttribute('colspan') || '1', 10)\r\n const rowspan = parseInt(cell.getAttribute('rowspan') || '1', 10)\r\n\r\n const cellNode: Record<string, unknown> = {\r\n type: isHeader ? 'tableHeader' : 'tableCell',\r\n content: [\r\n {\r\n type: 'paragraph',\r\n content: cellText ? [{ type: 'text', text: cellText }] : [],\r\n },\r\n ],\r\n }\r\n\r\n // Add attrs if colspan or rowspan is not 1\r\n if (colspan !== 1 || rowspan !== 1) {\r\n cellNode.attrs = {\r\n colspan,\r\n rowspan,\r\n }\r\n }\r\n\r\n cells.push(cellNode)\r\n })\r\n\r\n if (cells.length > 0) {\r\n rows.push({\r\n type: 'tableRow',\r\n content: cells,\r\n })\r\n }\r\n })\r\n\r\n if (rows.length === 0) return null\r\n\r\n return {\r\n type: 'table',\r\n content: rows,\r\n }\r\n}\r\n\r\nexport const PasteHandler = Extension.create({\r\n name: 'pasteHandler',\r\n\r\n addProseMirrorPlugins() {\r\n const { editor } = this\r\n\r\n return [\r\n new Plugin({\r\n key: new PluginKey('pasteHandler'),\r\n props: {\r\n handlePaste: (view, event, slice) => {\r\n const clipboardData = event.clipboardData\r\n if (!clipboardData) return false\r\n\r\n const html = clipboardData.getData('text/html')\r\n const text = clipboardData.getData('text/plain')\r\n\r\n // Handle iframe paste (from HTML)\r\n if (html && containsIframe(html)) {\r\n const attrs = extractIframeAttributes(html)\r\n if (attrs && attrs.src) {\r\n event.preventDefault()\r\n editor.chain().focus().setIframe({ src: attrs.src }).run()\r\n return true\r\n }\r\n }\r\n\r\n // Handle iframe embed code paste (as plain text containing <iframe>)\r\n if (text && containsIframe(text)) {\r\n const attrs = extractIframeAttributes(text)\r\n if (attrs && attrs.src) {\r\n event.preventDefault()\r\n editor.chain().focus().setIframe({ src: attrs.src }).run()\r\n return true\r\n }\r\n }\r\n\r\n // Handle embed URL paste (Flourish, Datawrapper, etc.)\r\n if (text && isEmbedUrl(text) && !html) {\r\n event.preventDefault()\r\n editor.chain().focus().setIframe({ src: text.trim() }).run()\r\n return true\r\n }\r\n\r\n // Handle plain text that contains HTML table markup (copy-pasted HTML code as text)\r\n // Check this FIRST before checking html, because pasting HTML code as text\r\n // will have the raw tags in text but might also have html content\r\n if (text && containsTable(text)) {\r\n // Check if the text itself contains raw HTML tags (not rendered)\r\n // This happens when someone copies HTML source code\r\n const hasRawHtmlTags = /<\\/?(?:table|tr|td|th|thead|tbody)[\\s>]/i.test(text)\r\n\r\n if (hasRawHtmlTags) {\r\n event.preventDefault()\r\n\r\n try {\r\n const tableJson = parseHtmlTableToJson(text)\r\n if (tableJson) {\r\n editor.chain().focus().insertContent(tableJson).run()\r\n return true\r\n }\r\n } catch (error) {\r\n console.error('Error parsing table from text:', error)\r\n }\r\n return false\r\n }\r\n }\r\n\r\n // Handle HTML table paste (from clipboard HTML - e.g., copying from a webpage)\r\n if (html && containsTable(html)) {\r\n event.preventDefault()\r\n\r\n try {\r\n const tableJson = parseHtmlTableToJson(html)\r\n if (tableJson) {\r\n editor.chain().focus().insertContent(tableJson).run()\r\n return true\r\n }\r\n } catch (error) {\r\n console.error('Error parsing table from HTML:', error)\r\n }\r\n return false\r\n }\r\n\r\n // Handle plain text table paste (tab-separated or similar)\r\n if (text && !html && isTabularData(text)) {\r\n event.preventDefault()\r\n const tableJson = convertTextToTable(text)\r\n if (tableJson) {\r\n editor.chain().focus().insertContent(tableJson).run()\r\n return true\r\n }\r\n }\r\n\r\n return false\r\n },\r\n },\r\n }),\r\n ]\r\n },\r\n})\r\n\r\n/**\r\n * Checks if text appears to be tabular data (tab or comma separated)\r\n */\r\nfunction isTabularData(text: string): boolean {\r\n const lines = text.trim().split('\\n')\r\n if (lines.length < 2) return false\r\n\r\n // Check if lines have consistent tab or comma separators\r\n const firstLineTabs = (lines[0].match(/\\t/g) || []).length\r\n const firstLineCommas = (lines[0].match(/,/g) || []).length\r\n\r\n if (firstLineTabs === 0 && firstLineCommas === 0) return false\r\n\r\n // Check consistency across lines\r\n const separator = firstLineTabs > 0 ? '\\t' : ','\r\n const expectedColumns = lines[0].split(separator).length\r\n\r\n return lines.every((line) => {\r\n const columns = line.split(separator).length\r\n return columns === expectedColumns || columns === expectedColumns - 1\r\n })\r\n}\r\n\r\n/**\r\n * Converts tab/comma separated text to table JSON\r\n */\r\nfunction convertTextToTable(text: string): Record<string, unknown> | null {\r\n const lines = text.trim().split('\\n')\r\n if (lines.length < 1) return null\r\n\r\n const firstLineTabs = (lines[0].match(/\\t/g) || []).length\r\n const separator = firstLineTabs > 0 ? '\\t' : ','\r\n\r\n const rows = lines.map((line, rowIndex) => {\r\n const cells = line.split(separator)\r\n const cellType = rowIndex === 0 ? 'tableHeader' : 'tableCell'\r\n\r\n return {\r\n type: 'tableRow',\r\n content: cells.map((cellText) => ({\r\n type: cellType,\r\n content: [\r\n {\r\n type: 'paragraph',\r\n content: cellText.trim() ? [{ type: 'text', text: cellText.trim() }] : [],\r\n },\r\n ],\r\n })),\r\n }\r\n })\r\n\r\n return {\r\n type: 'table',\r\n content: rows,\r\n }\r\n}\r\n\r\nexport default PasteHandler\r\n"],"names":["Extension","Plugin","PluginKey","containsTable","html","test","containsIframe","extractIframeAttributes","parser","DOMParser","doc","parseFromString","iframe","querySelector","attributes","attr","getAttributeNames","value","getAttribute","isEmbedUrl","text","embedPatterns","some","pattern","parseHtmlTableToJson","table","rows","tableRows","querySelectorAll","forEach","tr","rowIndex","cells","tableCells","cell","isHeader","tagName","toLowerCase","cellText","textContent","trim","colspan","parseInt","rowspan","cellNode","type","content","attrs","push","length","PasteHandler","create","name","addProseMirrorPlugins","editor","key","props","handlePaste","view","event","slice","clipboardData","getData","src","preventDefault","chain","focus","setIframe","run","hasRawHtmlTags","tableJson","insertContent","error","console","isTabularData","convertTextToTable","lines","split","firstLineTabs","match","firstLineCommas","separator","expectedColumns","every","line","columns","map","cellType"],"mappings":"AAAA,SAASA,SAAS,QAAQ,eAAc;AACxC,SAASC,MAAM,EAAEC,SAAS,QAAQ,mBAAkB;AAEpD;;CAEC,GACD,SAASC,cA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7B,MAAM6B,gBAAgB,AAACF,CAAAA,KAAK,CAAC,EAAE,CAACG,KAAK,CAAC,UAAU,EAAE,AAAD,EAAG9B,MAAM;IAC1D,MAAMgC,YAAYH,gBAAgB,IAAI,OAAO;IAE7C,MAAMpD,OAAOkD,MAAMU,GAAG,CAAC,CAACF,MAAMrD;QAC5B,MAAMC,QAAQoD,KAAKP,KAAK,CAACI;QACzB,MAAMM,WAAWxD,aAAa,IAAI,gBAAgB;QAElD,OAAO;YACLc,MAAM;YACNC,SAASd,MAAMsD,GAAG,CAAC,CAAChD,WAAc,CAAA;oBAChCO,MAAM0C;oBACNzC,SAAS;wBACP;4BACED,MAAM;4BACNC,SAASR,SAASE,IAAI,KAAK;gCAAC;oCAAEK,MAAM;oCAAQzB,MAAMkB,SAASE,IAAI;gCAAG;6BAAE,GAAG,EAAE;wBAC3E;qBACD;gBACH,CAAA;QACF;IACF;IAEA,OAAO;QACLK,MAAM;QACNC,SAASpB;IACX;AACF;AAEA,eAAewB,aAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/PasteHandler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/PasteHandler/index.ts"],"sourcesContent":["export { PasteHandler, default as default } from './PasteHandler.js'\r\n"],"names":["PasteHandler","default"],"mappings":"AAAA,SAASA,YAAY,EAAEC,WAAWA,OAAO,QAAQ,oBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/groups.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/groups.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGlC,eAAO,MAAM,MAAM,EAAE,KAAK,EA0LzB,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Facebook, Heading1, Heading2, Heading3, Image, Instagram, Link, List, Minus, Music, Quote, Twitter, Video, Youtube } from
|
|
2
|
-
import i18next from
|
|
1
|
+
import { Code, Facebook, Heading1, Heading2, Heading3, Image, Instagram, Link, List, Minus, Music, Quote, Table, Twitter, Video, Youtube } from 'lucide-react';
|
|
2
|
+
import i18next from 'i18next';
|
|
3
3
|
export const GROUPS = [
|
|
4
4
|
{
|
|
5
|
-
name:
|
|
6
|
-
title: i18next.t(
|
|
5
|
+
name: 'format',
|
|
6
|
+
title: i18next.t('format') || 'Format',
|
|
7
7
|
commands: [
|
|
8
8
|
{
|
|
9
|
-
name:
|
|
10
|
-
label: i18next.t(
|
|
11
|
-
description: i18next.t(
|
|
9
|
+
name: 'heading1',
|
|
10
|
+
label: i18next.t('heading1') || 'Heading 1',
|
|
11
|
+
description: i18next.t('heading1Desc') || 'High priority section title',
|
|
12
12
|
icon: Heading1,
|
|
13
13
|
aliases: [
|
|
14
|
-
|
|
14
|
+
'h1'
|
|
15
15
|
],
|
|
16
16
|
action: (editor)=>{
|
|
17
17
|
editor.chain().focus().setHeading({
|
|
@@ -20,12 +20,12 @@ export const GROUPS = [
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
name:
|
|
24
|
-
label: i18next.t(
|
|
25
|
-
description: i18next.t(
|
|
23
|
+
name: 'heading2',
|
|
24
|
+
label: i18next.t('heading2') || 'Heading 2',
|
|
25
|
+
description: i18next.t('heading2Desc') || 'Medium priority section title',
|
|
26
26
|
icon: Heading2,
|
|
27
27
|
aliases: [
|
|
28
|
-
|
|
28
|
+
'h2'
|
|
29
29
|
],
|
|
30
30
|
action: (editor)=>{
|
|
31
31
|
editor.chain().focus().setHeading({
|
|
@@ -34,12 +34,12 @@ export const GROUPS = [
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
|
-
name:
|
|
38
|
-
label: i18next.t(
|
|
39
|
-
description: i18next.t(
|
|
37
|
+
name: 'heading3',
|
|
38
|
+
label: i18next.t('heading3') || 'Heading 3',
|
|
39
|
+
description: i18next.t('heading3Desc') || 'Low priority section title',
|
|
40
40
|
icon: Heading3,
|
|
41
41
|
aliases: [
|
|
42
|
-
|
|
42
|
+
'h3'
|
|
43
43
|
],
|
|
44
44
|
action: (editor)=>{
|
|
45
45
|
editor.chain().focus().setHeading({
|
|
@@ -48,31 +48,21 @@ export const GROUPS = [
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
|
-
name:
|
|
52
|
-
label: i18next.t(
|
|
53
|
-
description: i18next.t(
|
|
51
|
+
name: 'bulletList',
|
|
52
|
+
label: i18next.t('bulletList') || 'Bullet List',
|
|
53
|
+
description: i18next.t('bulletListDesc') || 'Unordered list of items',
|
|
54
54
|
icon: List,
|
|
55
55
|
aliases: [
|
|
56
|
-
|
|
56
|
+
'ul'
|
|
57
57
|
],
|
|
58
58
|
action: (editor)=>{
|
|
59
59
|
editor.chain().focus().toggleBulletList().run();
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// icon: ListOrdered,
|
|
67
|
-
// aliases: ["ol"],
|
|
68
|
-
// action: (editor) => {
|
|
69
|
-
// editor.chain().focus().toggleOrderedList().run();
|
|
70
|
-
// },
|
|
71
|
-
// },
|
|
72
|
-
{
|
|
73
|
-
name: "blockquote",
|
|
74
|
-
label: i18next.t("blockquote") || "Blockquote",
|
|
75
|
-
description: i18next.t("blockquoteDesc") || "Element for quoting",
|
|
62
|
+
{
|
|
63
|
+
name: 'blockquote',
|
|
64
|
+
label: i18next.t('blockquote') || 'Blockquote',
|
|
65
|
+
description: i18next.t('blockquoteDesc') || 'Element for quoting',
|
|
76
66
|
icon: Quote,
|
|
77
67
|
action: (editor)=>{
|
|
78
68
|
editor.chain().focus().setBlockquote().run();
|
|
@@ -81,130 +71,164 @@ export const GROUPS = [
|
|
|
81
71
|
]
|
|
82
72
|
},
|
|
83
73
|
{
|
|
84
|
-
name:
|
|
85
|
-
title:
|
|
74
|
+
name: 'insert',
|
|
75
|
+
title: 'Insert',
|
|
86
76
|
commands: [
|
|
87
77
|
{
|
|
88
|
-
name:
|
|
89
|
-
label: i18next.t(
|
|
90
|
-
description: i18next.t(
|
|
78
|
+
name: 'image',
|
|
79
|
+
label: i18next.t('image') || 'Image',
|
|
80
|
+
description: i18next.t('imageDesc') || 'Insert an image',
|
|
91
81
|
icon: Image,
|
|
92
82
|
aliases: [
|
|
93
|
-
|
|
83
|
+
'img'
|
|
94
84
|
],
|
|
95
85
|
action: (editor)=>{
|
|
96
|
-
editor.chain().focus().setImageUpload(
|
|
86
|
+
editor.chain().focus().setImageUpload('image').run();
|
|
97
87
|
}
|
|
98
88
|
},
|
|
99
89
|
{
|
|
100
|
-
name:
|
|
101
|
-
label: i18next.t(
|
|
102
|
-
description: i18next.t(
|
|
90
|
+
name: 'video',
|
|
91
|
+
label: i18next.t('video') || 'Video',
|
|
92
|
+
description: i18next.t('videoDesc') || 'Insert a video',
|
|
103
93
|
icon: Video,
|
|
104
94
|
aliases: [
|
|
105
|
-
|
|
95
|
+
'video'
|
|
106
96
|
],
|
|
107
97
|
action: (editor)=>{
|
|
108
|
-
editor.chain().focus().setImageUpload(
|
|
98
|
+
editor.chain().focus().setImageUpload('video').run();
|
|
109
99
|
}
|
|
110
100
|
},
|
|
111
101
|
{
|
|
112
|
-
name:
|
|
113
|
-
label: i18next.t(
|
|
114
|
-
description: i18next.t(
|
|
102
|
+
name: 'horizontalRule',
|
|
103
|
+
label: i18next.t('horizontalRule') || 'HorizontalRule',
|
|
104
|
+
description: i18next.t('horizontalRuleDesc') || 'Insert a horizontal divider',
|
|
115
105
|
icon: Minus,
|
|
116
106
|
aliases: [
|
|
117
|
-
|
|
107
|
+
'hr'
|
|
118
108
|
],
|
|
119
109
|
action: (editor)=>{
|
|
120
110
|
editor.chain().focus().setHorizontalRule().run();
|
|
121
111
|
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: 'table',
|
|
115
|
+
label: i18next.t('table') || 'Table',
|
|
116
|
+
description: i18next.t('tableDesc') || 'Insert a table',
|
|
117
|
+
icon: Table,
|
|
118
|
+
aliases: [
|
|
119
|
+
'table'
|
|
120
|
+
],
|
|
121
|
+
action: (editor)=>{
|
|
122
|
+
editor.chain().focus().insertTable({
|
|
123
|
+
rows: 3,
|
|
124
|
+
cols: 3,
|
|
125
|
+
withHeaderRow: true
|
|
126
|
+
}).run();
|
|
127
|
+
}
|
|
122
128
|
}
|
|
123
129
|
]
|
|
124
130
|
},
|
|
125
131
|
{
|
|
126
|
-
name:
|
|
127
|
-
title:
|
|
132
|
+
name: 'embed',
|
|
133
|
+
title: 'Embed',
|
|
128
134
|
commands: [
|
|
129
135
|
{
|
|
130
|
-
name:
|
|
131
|
-
label: i18next.t(
|
|
132
|
-
description: i18next.t(
|
|
136
|
+
name: 'linkPreview',
|
|
137
|
+
label: i18next.t('embed') || 'Embed Link',
|
|
138
|
+
description: i18next.t('iframeDesc') || 'Insert an Embed link',
|
|
133
139
|
icon: Link,
|
|
134
140
|
aliases: [
|
|
135
|
-
|
|
141
|
+
'linkPreview'
|
|
136
142
|
],
|
|
137
|
-
shouldBeHidden: (editor)=>editor.isActive(
|
|
143
|
+
shouldBeHidden: (editor)=>editor.isActive('linkPreview'),
|
|
138
144
|
action: (editor)=>{
|
|
139
145
|
editor.chain().focus().setLinkPreview().run();
|
|
140
146
|
}
|
|
141
147
|
},
|
|
142
148
|
{
|
|
143
|
-
name:
|
|
144
|
-
label: i18next.t(
|
|
145
|
-
description: i18next.t(
|
|
149
|
+
name: 'twitter',
|
|
150
|
+
label: i18next.t('twitter') || 'Twitter',
|
|
151
|
+
description: i18next.t('twitterDesc') || 'Insert a Twitter embed',
|
|
146
152
|
icon: Twitter,
|
|
147
153
|
aliases: [
|
|
148
|
-
|
|
149
|
-
|
|
154
|
+
'x',
|
|
155
|
+
'twitter'
|
|
150
156
|
],
|
|
151
|
-
shouldBeHidden: (editor)=>editor.isActive(
|
|
157
|
+
shouldBeHidden: (editor)=>editor.isActive('twitter'),
|
|
152
158
|
action: (editor)=>{
|
|
153
159
|
editor.chain().focus().insertTwitter().run();
|
|
154
160
|
}
|
|
155
161
|
},
|
|
156
162
|
{
|
|
157
|
-
name:
|
|
158
|
-
label: i18next.t(
|
|
159
|
-
description: i18next.t(
|
|
163
|
+
name: 'facebook',
|
|
164
|
+
label: i18next.t('facebook') || 'Facebook',
|
|
165
|
+
description: i18next.t('facebookDesc') || 'Insert a Facebook embed',
|
|
160
166
|
icon: Facebook,
|
|
161
167
|
aliases: [
|
|
162
|
-
|
|
163
|
-
|
|
168
|
+
'meta',
|
|
169
|
+
'facebook'
|
|
164
170
|
],
|
|
165
|
-
shouldBeHidden: (editor)=>editor.isActive(
|
|
171
|
+
shouldBeHidden: (editor)=>editor.isActive('facebook'),
|
|
166
172
|
action: (editor)=>{
|
|
167
173
|
editor.chain().focus().insertFacebook().run();
|
|
168
174
|
}
|
|
169
175
|
},
|
|
170
176
|
{
|
|
171
|
-
name:
|
|
172
|
-
label: i18next.t(
|
|
173
|
-
description: i18next.t(
|
|
177
|
+
name: 'instagram',
|
|
178
|
+
label: i18next.t('instagram') || 'Instagram',
|
|
179
|
+
description: i18next.t('instagramDesc') || 'Insert a Instagram embed',
|
|
174
180
|
icon: Instagram,
|
|
175
181
|
aliases: [
|
|
176
|
-
|
|
182
|
+
'instagram'
|
|
177
183
|
],
|
|
178
|
-
shouldBeHidden: (editor)=>editor.isActive(
|
|
184
|
+
shouldBeHidden: (editor)=>editor.isActive('instagram'),
|
|
179
185
|
action: (editor)=>{
|
|
180
186
|
editor.chain().focus().insertInstagram().run();
|
|
181
187
|
}
|
|
182
188
|
},
|
|
183
189
|
{
|
|
184
|
-
name:
|
|
185
|
-
label: i18next.t(
|
|
186
|
-
description: i18next.t(
|
|
190
|
+
name: 'youtube',
|
|
191
|
+
label: i18next.t('youtube') || 'Youtube',
|
|
192
|
+
description: i18next.t('youtubeDesc') || 'Insert a Youtube embed',
|
|
187
193
|
icon: Youtube,
|
|
188
194
|
aliases: [
|
|
189
|
-
|
|
195
|
+
'youtube'
|
|
190
196
|
],
|
|
191
|
-
shouldBeHidden: (editor)=>editor.isActive(
|
|
197
|
+
shouldBeHidden: (editor)=>editor.isActive('youtube'),
|
|
192
198
|
action: (editor)=>{
|
|
193
199
|
editor.chain().focus().insertYoutube().run();
|
|
194
200
|
}
|
|
195
201
|
},
|
|
196
202
|
{
|
|
197
|
-
name:
|
|
198
|
-
label: i18next.t(
|
|
199
|
-
description: i18next.t(
|
|
203
|
+
name: 'tiktok',
|
|
204
|
+
label: i18next.t('tiktok') || 'Tiktok',
|
|
205
|
+
description: i18next.t('tiktokDesc') || 'Insert a Tiktok embed',
|
|
200
206
|
icon: Music,
|
|
201
207
|
aliases: [
|
|
202
|
-
|
|
208
|
+
'tiktok'
|
|
203
209
|
],
|
|
204
|
-
shouldBeHidden: (editor)=>editor.isActive(
|
|
210
|
+
shouldBeHidden: (editor)=>editor.isActive('tiktok'),
|
|
205
211
|
action: (editor)=>{
|
|
206
212
|
editor.chain().focus().insertTiktok().run();
|
|
207
213
|
}
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: 'iframe',
|
|
217
|
+
label: i18next.t('iframe') || 'Iframe / Embed',
|
|
218
|
+
description: i18next.t('iframeEmbedDesc') || 'Embed external content (Flourish, Datawrapper, etc.)',
|
|
219
|
+
icon: Code,
|
|
220
|
+
aliases: [
|
|
221
|
+
'iframe',
|
|
222
|
+
'embed',
|
|
223
|
+
'flourish',
|
|
224
|
+
'datawrapper'
|
|
225
|
+
],
|
|
226
|
+
shouldBeHidden: (editor)=>editor.isActive('iframe'),
|
|
227
|
+
action: (editor)=>{
|
|
228
|
+
editor.chain().focus().setIframe({
|
|
229
|
+
src: ''
|
|
230
|
+
}).run();
|
|
231
|
+
}
|
|
208
232
|
}
|
|
209
233
|
]
|
|
210
234
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/groups.ts"],"sourcesContent":["import {\r\n Facebook,\r\n Heading1,\r\n Heading2,\r\n Heading3,\r\n Image,\r\n Instagram,\r\n Link,\r\n List,\r\n ListOrdered,\r\n Minus,\r\n Music,\r\n Quote,\r\n Twitter,\r\n Video,\r\n Youtube,\r\n} from \"lucide-react\";\r\nimport { Group } from \"./types.js\";\r\nimport i18next from \"i18next\";\r\n\r\nexport const GROUPS: Group[] = [\r\n {\r\n name: \"format\",\r\n title: i18next.t(\"format\") || \"Format\",\r\n commands: [\r\n {\r\n name: \"heading1\",\r\n label: i18next.t(\"heading1\") || \"Heading 1\",\r\n description: i18next.t(\"heading1Desc\") || \"High priority section title\",\r\n icon: Heading1,\r\n aliases: [\"h1\"],\r\n action: (editor) => {\r\n editor.chain().focus().setHeading({ level: 1 }).run();\r\n },\r\n },\r\n {\r\n name: \"heading2\",\r\n label: i18next.t(\"heading2\") || \"Heading 2\",\r\n description:\r\n i18next.t(\"heading2Desc\") || \"Medium priority section title\",\r\n icon: Heading2,\r\n aliases: [\"h2\"],\r\n action: (editor) => {\r\n editor.chain().focus().setHeading({ level: 2 }).run();\r\n },\r\n },\r\n {\r\n name: \"heading3\",\r\n label: i18next.t(\"heading3\") || \"Heading 3\",\r\n description: i18next.t(\"heading3Desc\") || \"Low priority section title\",\r\n icon: Heading3,\r\n aliases: [\"h3\"],\r\n action: (editor) => {\r\n editor.chain().focus().setHeading({ level: 3 }).run();\r\n },\r\n },\r\n {\r\n name: \"bulletList\",\r\n label: i18next.t(\"bulletList\") || 'Bullet List',\r\n description: i18next.t(\"bulletListDesc\") || \"Unordered list of items\",\r\n icon: List,\r\n aliases: [\"ul\"],\r\n action: (editor) => {\r\n editor.chain().focus().toggleBulletList().run();\r\n },\r\n },\r\n // {\r\n // name: \"numberedList\",\r\n // label: i18next.t(\"numberedList\") || 'Numbered List',\r\n // description:i18next.t(\"numberedListDesc\") || \"Ordered list of items\",\r\n // icon: ListOrdered,\r\n // aliases: [\"ol\"],\r\n // action: (editor) => {\r\n // editor.chain().focus().toggleOrderedList().run();\r\n // },\r\n // },\r\n\r\n {\r\n name: \"blockquote\",\r\n label: i18next.t(\"blockquote\") || \"Blockquote\",\r\n description: i18next.t(\"blockquoteDesc\") || \"Element for quoting\",\r\n icon: Quote,\r\n action: (editor) => {\r\n editor.chain().focus().setBlockquote().run();\r\n },\r\n },\r\n ],\r\n },\r\n {\r\n name: \"insert\",\r\n title: \"Insert\",\r\n commands: [\r\n {\r\n name: \"image\",\r\n label: i18next.t(\"image\") || \"Image\",\r\n description: i18next.t(\"imageDesc\") || \"Insert an image\",\r\n icon: Image,\r\n aliases: [\"img\"],\r\n action: (editor) => {\r\n editor.chain().focus().setImageUpload(\"image\").run();\r\n },\r\n },\r\n {\r\n name: \"video\",\r\n label: i18next.t(\"video\") || \"Video\",\r\n description: i18next.t(\"videoDesc\") || \"Insert a video\",\r\n icon: Video,\r\n aliases: [\"video\"],\r\n action: (editor) => {\r\n editor.chain().focus().setImageUpload(\"video\").run();\r\n },\r\n },\r\n\r\n {\r\n name: \"horizontalRule\",\r\n label: i18next.t(\"horizontalRule\") || \"HorizontalRule\",\r\n description:\r\n i18next.t(\"horizontalRuleDesc\") || \"Insert a horizontal divider\",\r\n icon: Minus,\r\n aliases: [\"hr\"],\r\n action: (editor) => {\r\n editor.chain().focus().setHorizontalRule().run();\r\n },\r\n },\r\n ],\r\n },\r\n {\r\n name: \"embed\",\r\n title: \"Embed\",\r\n commands: [\r\n {\r\n name: \"linkPreview\",\r\n label: i18next.t(\"embed\") || \"Embed Link\",\r\n description: i18next.t(\"iframeDesc\") || \"Insert an Embed link\",\r\n icon: Link,\r\n aliases: [\"linkPreview\"],\r\n shouldBeHidden: (editor) => editor.isActive(\"linkPreview\"),\r\n action: (editor) => {\r\n editor.chain().focus().setLinkPreview().run();\r\n },\r\n },\r\n {\r\n name: \"twitter\",\r\n label: i18next.t(\"twitter\") || \"Twitter\",\r\n description: i18next.t(\"twitterDesc\") || \"Insert a Twitter embed\",\r\n icon: Twitter,\r\n aliases: [\"x\", \"twitter\"],\r\n shouldBeHidden: (editor) => editor.isActive(\"twitter\"),\r\n action: (editor) => {\r\n editor.chain().focus().insertTwitter().run();\r\n },\r\n },\r\n {\r\n name: \"facebook\",\r\n label: i18next.t(\"facebook\") || \"Facebook\",\r\n description: i18next.t(\"facebookDesc\") || \"Insert a Facebook embed\",\r\n icon: Facebook,\r\n aliases: [\"meta\", \"facebook\"],\r\n shouldBeHidden: (editor) => editor.isActive(\"facebook\"),\r\n action: (editor) => {\r\n editor.chain().focus().insertFacebook().run();\r\n },\r\n },\r\n {\r\n name: \"instagram\",\r\n label: i18next.t(\"instagram\") || \"Instagram\",\r\n description: i18next.t(\"instagramDesc\") || \"Insert a Instagram embed\",\r\n icon: Instagram,\r\n aliases: [\"instagram\"],\r\n shouldBeHidden: (editor) => editor.isActive(\"instagram\"),\r\n action: (editor) => {\r\n editor.chain().focus().insertInstagram().run();\r\n },\r\n },\r\n {\r\n name: \"youtube\",\r\n label: i18next.t(\"youtube\") || \"Youtube\",\r\n description: i18next.t(\"youtubeDesc\") || \"Insert a Youtube embed\",\r\n icon: Youtube,\r\n aliases: [\"youtube\"],\r\n shouldBeHidden: (editor) => editor.isActive(\"youtube\"),\r\n action: (editor) => {\r\n editor.chain().focus().insertYoutube().run();\r\n },\r\n },\r\n\r\n {\r\n name: \"tiktok\",\r\n label: i18next.t(\"tiktok\") || \"Tiktok\",\r\n description: i18next.t(\"tiktokDesc\") || \"Insert a Tiktok embed\",\r\n icon: Music,\r\n aliases: [\"tiktok\"],\r\n shouldBeHidden: (editor) => editor.isActive(\"tiktok\"),\r\n action: (editor) => {\r\n editor.chain().focus().insertTiktok().run();\r\n },\r\n },\r\n ],\r\n },\r\n];\r\n\r\nexport default GROUPS;\r\n"],"names":["Facebook","Heading1","Heading2","Heading3","Image","Instagram","Link","List","Minus","Music","Quote","Twitter","Video","Youtube","i18next","GROUPS","name","title","t","commands","label","description","icon","aliases","action","editor","chain","focus","setHeading","level","run","toggleBulletList","setBlockquote","setImageUpload","setHorizontalRule","shouldBeHidden","isActive","setLinkPreview","insertTwitter","insertFacebook","insertInstagram","insertYoutube","insertTiktok"],"mappings":"AAAA,SACEA,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EACRC,KAAK,EACLC,SAAS,EACTC,IAAI,EACJC,IAAI,EAEJC,KAAK,EACLC,KAAK,EACLC,KAAK,EACLC,OAAO,EACPC,KAAK,EACLC,OAAO,QACF,eAAe;AAEtB,OAAOC,aAAa,UAAU;AAE9B,OAAO,MAAMC,SAAkB;IAC7B;QACEC,MAAM;QACNC,OAAOH,QAAQI,CAAC,CAAC,aAAa;QAC9BC,UAAU;YACR;gBACEH,MAAM;gBACNI,OAAON,QAAQI,CAAC,CAAC,eAAe;gBAChCG,aAAaP,QAAQI,CAAC,CAAC,mBAAmB;gBAC1CI,MAAMrB;gBACNsB,SAAS;oBAAC;iBAAK;gBACfC,QAAQ,CAACC;oBACPA,OAAOC,KAAK,GAAGC,KAAK,GAAGC,UAAU,CAAC;wBAAEC,OAAO;oBAAE,GAAGC,GAAG;gBACrD;YACF;YACA;gBACEd,MAAM;gBACNI,OAAON,QAAQI,CAAC,CAAC,eAAe;gBAChCG,aACEP,QAAQI,CAAC,CAAC,mBAAmB;gBAC/BI,MAAMpB;gBACNqB,SAAS;oBAAC;iBAAK;gBACfC,QAAQ,CAACC;oBACPA,OAAOC,KAAK,GAAGC,KAAK,G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I,MAAMtB;gBACNuB,SAAS;oBAAC;oBAAQ;iBAAW;gBAC7BY,gBAAgB,CAACV,SAAWA,OAAOW,QAAQ,CAAC;gBAC5CZ,QAAQ,CAACC;oBACPA,OAAOC,KAAK,GAAGC,KAAK,GAAGY,cAAc,GAAGT,GAAG;gBAC7C;YACF;YACA;gBACEd,MAAM;gBACNI,OAAON,QAAQI,CAAC,CAAC,gBAAgB;gBACjCG,aAAaP,QAAQI,CAAC,CAAC,oBAAoB;gBAC3CI,MAAMjB;gBACNkB,SAAS;oBAAC;iBAAY;gBACtBY,gBAAgB,CAACV,SAAWA,OAAOW,QAAQ,CAAC;gBAC5CZ,QAAQ,CAACC;oBACPA,OAAOC,KAAK,GAAGC,KAAK,GAAGa,eAAe,GAAGV,GAAG;gBAC9C;YACF;YACA;gBACEd,MAAM;gBACNI,OAAON,QAAQI,CAAC,CAAC,cAAc;gBAC/BG,aAAaP,QAAQI,CAAC,CAAC,kBAAkB;gBACzCI,MAAMT;gBACNU,SAAS;oBAAC;iBAAU;gBACpBY,gBAAgB,CAACV,SAAWA,OAAOW,QAAQ,CAAC;gBAC5CZ,QAAQ,CAACC;oBACPA,OAAOC,KAAK,GAAGC,KAAK,GAAGc,aAAa,GAAGX,GAAG;gBAC5C;YACF;YAEA;gBACEd,MAAM;gBACNI,OAAON,QAAQI,CAAC,CAAC,aAAa;gBAC9BG,aAAaP,QAAQI,CAAC,CAAC,iBAAiB;gBACxCI,MAAMb;gBACNc,SAAS;oBAAC;iBAAS;gBACnBY,gBAAgB,CAACV,SAAWA,OAAOW,QAAQ,CAAC;gBAC5CZ,QAAQ,CAACC;oBACPA,OAAOC,KAAK,GAAGC,KAAK,GAAGe,YAAY,GAAGZ,GAAG;gBAC3C;YACF;SACD;IACH;CACD,CAAC;AAEF,eAAef,OAAO"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/groups.ts"],"sourcesContent":["import {\r\n Code,\r\n Facebook,\r\n Heading1,\r\n Heading2,\r\n Heading3,\r\n Image,\r\n Instagram,\r\n Link,\r\n List,\r\n Minus,\r\n Music,\r\n Quote,\r\n Table,\r\n Twitter,\r\n Video,\r\n Youtube,\r\n} from 'lucide-react'\r\nimport { Group } from './types.js'\r\nimport i18next from 'i18next'\r\n\r\nexport const GROUPS: Group[] = [\r\n {\r\n name: 'format',\r\n title: i18next.t('format') || 'Format',\r\n commands: [\r\n {\r\n name: 'heading1',\r\n label: i18next.t('heading1') || 'Heading 1',\r\n description: i18next.t('heading1Desc') || 'High priority section title',\r\n icon: Heading1,\r\n aliases: ['h1'],\r\n action: (editor) => {\r\n editor.chain().focus().setHeading({ level: 1 }).run()\r\n },\r\n },\r\n {\r\n name: 'heading2',\r\n label: i18next.t('heading2') || 'Heading 2',\r\n description: i18next.t('heading2Desc') || 'Medium priority section title',\r\n icon: Heading2,\r\n aliases: ['h2'],\r\n action: (editor) => {\r\n editor.chain().focus().setHeading({ level: 2 }).run()\r\n },\r\n },\r\n {\r\n name: 'heading3',\r\n label: i18next.t('heading3') || 'Heading 3',\r\n description: i18next.t('heading3Desc') || 'Low priority section title',\r\n icon: Heading3,\r\n aliases: ['h3'],\r\n action: (editor) => {\r\n editor.chain().focus().setHeading({ level: 3 }).run()\r\n },\r\n },\r\n {\r\n name: 'bulletList',\r\n label: i18next.t('bulletList') || 'Bullet List',\r\n description: i18next.t('bulletListDesc') || 'Unordered list of items',\r\n icon: List,\r\n aliases: ['ul'],\r\n action: (editor) => {\r\n editor.chain().focus().toggleBulletList().run()\r\n },\r\n },\r\n {\r\n name: 'blockquote',\r\n label: i18next.t('blockquote') || 'Blockquote',\r\n description: i18next.t('blockquoteDesc') || 'Element for quoting',\r\n icon: Quote,\r\n action: (editor) => {\r\n editor.chain().focus().setBlockquote().run()\r\n },\r\n },\r\n ],\r\n },\r\n {\r\n name: 'insert',\r\n title: 'Insert',\r\n commands: [\r\n {\r\n name: 'image',\r\n label: i18next.t('image') || 'Image',\r\n description: i18next.t('imageDesc') || 'Insert an image',\r\n icon: Image,\r\n aliases: ['img'],\r\n action: (editor) => {\r\n editor.chain().focus().setImageUpload('image').run()\r\n },\r\n },\r\n {\r\n name: 'video',\r\n label: i18next.t('video') || 'Video',\r\n description: i18next.t('videoDesc') || 'Insert a video',\r\n icon: Video,\r\n aliases: ['video'],\r\n action: (editor) => {\r\n editor.chain().focus().setImageUpload('video').run()\r\n },\r\n },\r\n {\r\n name: 'horizontalRule',\r\n label: i18next.t('horizontalRule') || 'HorizontalRule',\r\n description: i18next.t('horizontalRuleDesc') || 'Insert a horizontal divider',\r\n icon: Minus,\r\n aliases: ['hr'],\r\n action: (editor) => {\r\n editor.chain().focus().setHorizontalRule().run()\r\n },\r\n },\r\n {\r\n name: 'table',\r\n label: i18next.t('table') || 'Table',\r\n description: i18next.t('tableDesc') || 'Insert a table',\r\n icon: Table,\r\n aliases: ['table'],\r\n action: (editor) => {\r\n editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run()\r\n },\r\n },\r\n ],\r\n },\r\n {\r\n name: 'embed',\r\n title: 'Embed',\r\n commands: [\r\n {\r\n name: 'linkPreview',\r\n label: i18next.t('embed') || 'Embed Link',\r\n description: i18next.t('iframeDesc') || 'Insert an Embed link',\r\n icon: Link,\r\n aliases: ['linkPreview'],\r\n shouldBeHidden: (editor) => editor.isActive('linkPreview'),\r\n action: (editor) => {\r\n editor.chain().focus().setLinkPreview().run()\r\n },\r\n },\r\n {\r\n name: 'twitter',\r\n label: i18next.t('twitter') || 'Twitter',\r\n description: i18next.t('twitterDesc') || 'Insert a Twitter embed',\r\n icon: Twitter,\r\n aliases: ['x', 'twitter'],\r\n shouldBeHidden: (editor) => editor.isActive('twitter'),\r\n action: (editor) => {\r\n editor.chain().focus().insertTwitter().run()\r\n },\r\n },\r\n {\r\n name: 'facebook',\r\n label: i18next.t('facebook') || 'Facebook',\r\n description: i18next.t('facebookDesc') || 'Insert a Facebook embed',\r\n icon: Facebook,\r\n aliases: ['meta', 'facebook'],\r\n shouldBeHidden: (editor) => editor.isActive('facebook'),\r\n action: (editor) => {\r\n editor.chain().focus().insertFacebook().run()\r\n },\r\n },\r\n {\r\n name: 'instagram',\r\n label: i18next.t('instagram') || 'Instagram',\r\n description: i18next.t('instagramDesc') || 'Insert a Instagram embed',\r\n icon: Instagram,\r\n aliases: ['instagram'],\r\n shouldBeHidden: (editor) => editor.isActive('instagram'),\r\n action: (editor) => {\r\n editor.chain().focus().insertInstagram().run()\r\n },\r\n },\r\n {\r\n name: 'youtube',\r\n label: i18next.t('youtube') || 'Youtube',\r\n description: i18next.t('youtubeDesc') || 'Insert a Youtube embed',\r\n icon: Youtube,\r\n aliases: ['youtube'],\r\n shouldBeHidden: (editor) => editor.isActive('youtube'),\r\n action: (editor) => {\r\n editor.chain().focus().insertYoutube().run()\r\n },\r\n },\r\n {\r\n name: 'tiktok',\r\n label: i18next.t('tiktok') || 'Tiktok',\r\n description: i18next.t('tiktokDesc') || 'Insert a Tiktok embed',\r\n icon: Music,\r\n aliases: ['tiktok'],\r\n shouldBeHidden: (editor) => editor.isActive('tiktok'),\r\n action: (editor) => {\r\n editor.chain().focus().insertTiktok().run()\r\n },\r\n },\r\n {\r\n name: 'iframe',\r\n label: i18next.t('iframe') || 'Iframe / Embed',\r\n description:\r\n i18next.t('iframeEmbedDesc') || 'Embed external content (Flourish, Datawrapper, etc.)',\r\n icon: Code,\r\n aliases: ['iframe', 'embed', 'flourish', 'datawrapper'],\r\n shouldBeHidden: (editor) => editor.isActive('iframe'),\r\n action: (editor) => {\r\n editor.chain().focus().setIframe({ src: '' }).run()\r\n },\r\n },\r\n ],\r\n },\r\n]\r\n\r\nexport default GROUPS\r\n"],"names":["Code","Facebook","Heading1","Heading2","Heading3","Image","Instagram","Link","List","Minus","Music","Quote","Table","Twitter","Video","Youtube","i18next","GROUPS","name","title","t","commands","label","description","icon","aliases","action","editor","chain","focus","setHeading","level","run","toggleBulletList","setBlockquote","setImageUpload","setHorizontalRule","insertTable","rows","cols","withHeaderRow","shouldBeHidden","isActive","setLinkPreview","insertTwitter","insertFacebook","insertInstagram","insertYoutube","insertTiktok","setIframe","src"],"mappings":"AAAA,SACEA,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EACRC,KAAK,EACLC,SAAS,EACTC,IAAI,EACJC,IAAI,EACJC,KAAK,EACLC,KAAK,EACLC,KAAK,EACLC,KAAK,EACLC,OAAO,EACPC,KAAK,EACLC,OAAO,QACF,eAAc;AAErB,OAAOC,aAAa,UAAS;AAE7B,OAAO,MAAMC,SAAkB;IAC7B;QACEC,MAAM;QACNC,OAAOH,QAAQI,CAAC,CAAC,aAAa;QAC9BC,UAAU;YACR;gBACEH,MAAM;gBACNI,OAAON,QAAQI,CAAC,CAAC,eAAe;gBAChCG,aAAaP,QAAQI,CAAC,CAAC,mBAAmB;gBAC1CI,MAAMtB;gBACNuB,SAAS;oBAAC;iBAAK;gBACfC,QAAQ,CAACC;oBACPA,OAAOC,KAAK,GAAGC,KAAK,GAAGC,UAAU,CAAC;wBAAEC,OAAO;oBAAE,GAAGC,GAAG;gBACrD;YACF;YACA;gBACEd,MAAM;gBACNI,OAAON,QAAQI,CAAC,CAAC,eAAe;gBAChCG,aAAaP,QAAQI,CAAC,CAAC,mBAAmB;gBAC1CI,MAAMrB;gBACNsB,SAAS;oBAAC;iBAAK;gBACfC,QAAQ,CAACC;oBACPA,OAAOC,KAAK,GAAGC,KAAK,GAAGC,UAAU,CAAC;wBAAEC,OAAO;oBAAE,GAAGC,GAAG;gBACrD;YACF;YACA;gBACEd,MAAM;gBACNI,OAAON,QAAQI,CAAC,CAAC,eAAe;gBAChCG,aAAaP,QAAQI,CAAC,CAAC,mBAAmB;gBAC1CI,MAAMpB;gBACNqB,SAAS;oBAAC;iBAAK;gBACfC,QAAQ,CAACC;oBACPA,OAAOC,KAAK,GAAGC,KAAK,GAAGC,UAAU,CAAC;wBAAEC,OAAO;oBAAE,GAAGC,GAA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;wBAAEC,KAAK;oBAAG,GAAGlB,GAAG;gBACnD;YACF;SACD;IACH;CACD,CAAA;AAED,eAAef,OAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/Table/Table.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/Table/Table.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,kFAIhB,CAAA;AAEF,eAAe,KAAK,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/Table/Table.ts"],"sourcesContent":["import TiptapTable from '@tiptap/extension-table'\r\n\r\nexport const Table = TiptapTable.configure({
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/Table/Table.ts"],"sourcesContent":["import TiptapTable from '@tiptap/extension-table'\r\n\r\nexport const Table = TiptapTable.configure({\r\n resizable: true,\r\n lastColumnResizable: false,\r\n allowTableNodeSelection: true,\r\n})\r\n\r\nexport default Table\r\n"],"names":["TiptapTable","Table","configure","resizable","lastColumnResizable","allowTableNodeSelection"],"mappings":"AAAA,OAAOA,iBAAiB,0BAAyB;AAEjD,OAAO,MAAMC,QAAQD,YAAYE,SAAS,CAAC;IACzCC,WAAW;IACXC,qBAAqB;IACrBC,yBAAyB;AAC3B,GAAE;AAEF,eAAeJ,MAAK"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { openAssetHQType } from
|
|
1
|
+
import { openAssetHQType } from '../types.js';
|
|
2
2
|
interface ExtensionKitProps {
|
|
3
3
|
openAssetHQHandler: openAssetHQType;
|
|
4
|
-
dir?:
|
|
4
|
+
dir?: 'ltr' | 'rtl';
|
|
5
5
|
}
|
|
6
|
-
export declare const ExtensionKit: ({ dir, openAssetHQHandler
|
|
6
|
+
export declare const ExtensionKit: ({ dir, openAssetHQHandler }: ExtensionKitProps) => (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Mark<import("@tiptap/extension-subscript").SubscriptExtensionOptions, any>)[];
|
|
7
7
|
export default ExtensionKit;
|
|
8
8
|
//# sourceMappingURL=extension-kit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-kit.d.ts","sourceRoot":"","sources":["../../../../../src/fields/TiptapEditor/extensions/extension-kit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extension-kit.d.ts","sourceRoot":"","sources":["../../../../../src/fields/TiptapEditor/extensions/extension-kit.ts"],"names":[],"mappings":"AAuDA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAI7C,UAAU,iBAAiB;IACzB,kBAAkB,EAAE,eAAe,CAAA;IACnC,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAA;CACpB;AAED,eAAO,MAAM,YAAY,gCAAyC,iBAAiB,+LAiIlF,CAAA;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AICommand, AudioBlock, BlockquoteFigure, CharacterCount, Document, Dropcursor, Facebook, Figcaption, FileHandler, Focus, Heading, HorizontalRule, LinkPreview, ImageBlock, InsideLinks, Instagram, Link, Linkedin, Placeholder, Selection, SlashCommand, StarterKit, Subscript, Superscript, TaskItem, TaskList, TextAlign, TextStyle, Tiktok,
|
|
2
|
-
import { ImageUpload } from
|
|
3
|
-
import History from
|
|
4
|
-
import { Markdown } from
|
|
5
|
-
import API from
|
|
6
|
-
import i18next from
|
|
7
|
-
import { getAssetActualSize } from
|
|
8
|
-
export const ExtensionKit = ({ dir =
|
|
1
|
+
import { AICommand, AudioBlock, BlockquoteFigure, CharacterCount, Document, Dropcursor, Facebook, Figcaption, FileHandler, Focus, Heading, HorizontalRule, LinkPreview, ImageBlock, InsideLinks, Instagram, Link, Linkedin, Paragraph, PasteHandler, Placeholder, Selection, SlashCommand, StarterKit, Subscript, Superscript, Table, TableCell, TableHeader, TableRow, TaskItem, TaskList, TextAlign, TextStyle, Tiktok, Twitter, Typography, Underline, VideoBlock, Youtube, Iframe, BulletList } from './index.js';
|
|
2
|
+
import { ImageUpload } from './ImageUpload/ImageUpload.js';
|
|
3
|
+
import History from '@tiptap/extension-history';
|
|
4
|
+
import { Markdown } from 'tiptap-markdown';
|
|
5
|
+
import API from '../lib/api.js';
|
|
6
|
+
import i18next from 'i18next';
|
|
7
|
+
import { getAssetActualSize } from './ImageUpload/getImageActualSize.js';
|
|
8
|
+
export const ExtensionKit = ({ dir = 'ltr', openAssetHQHandler })=>[
|
|
9
9
|
Markdown,
|
|
10
10
|
Document,
|
|
11
11
|
TaskList,
|
|
@@ -31,13 +31,15 @@ export const ExtensionKit = ({ dir = "ltr", openAssetHQHandler })=>[
|
|
|
31
31
|
horizontalRule: false,
|
|
32
32
|
blockquote: false,
|
|
33
33
|
history: false,
|
|
34
|
-
codeBlock: false
|
|
34
|
+
codeBlock: false,
|
|
35
|
+
paragraph: false
|
|
35
36
|
}),
|
|
37
|
+
Paragraph,
|
|
36
38
|
TextStyle,
|
|
37
39
|
// FontSize,
|
|
38
40
|
// FontFamily,
|
|
39
41
|
// Color,
|
|
40
|
-
TrailingNode,
|
|
42
|
+
// TrailingNode,
|
|
41
43
|
Link.configure({
|
|
42
44
|
openOnClick: false
|
|
43
45
|
}),
|
|
@@ -54,17 +56,17 @@ export const ExtensionKit = ({ dir = "ltr", openAssetHQHandler })=>[
|
|
|
54
56
|
AudioBlock,
|
|
55
57
|
FileHandler.configure({
|
|
56
58
|
allowedMimeTypes: [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
'image/png',
|
|
60
|
+
'image/jpeg',
|
|
61
|
+
'image/gif',
|
|
62
|
+
'image/webp'
|
|
61
63
|
],
|
|
62
64
|
onDrop: (currentEditor, files, pos)=>{
|
|
63
65
|
const file = files[0];
|
|
64
66
|
(async ()=>{
|
|
65
67
|
openAssetHQHandler((asset)=>{
|
|
66
68
|
let title = asset.title;
|
|
67
|
-
if (i18next.language !==
|
|
69
|
+
if (i18next.language !== 'en' && !!asset.title_locale[i18next.language.toUpperCase()]) {
|
|
68
70
|
title = asset.title_locale[i18next.language.toUpperCase()];
|
|
69
71
|
}
|
|
70
72
|
const { actualHeight, actualWidth } = getAssetActualSize(asset);
|
|
@@ -75,7 +77,7 @@ export const ExtensionKit = ({ dir = "ltr", openAssetHQHandler })=>[
|
|
|
75
77
|
actualHeight,
|
|
76
78
|
actualWidth
|
|
77
79
|
}).focus().run();
|
|
78
|
-
}, file,
|
|
80
|
+
}, file, 'image');
|
|
79
81
|
})();
|
|
80
82
|
},
|
|
81
83
|
onPaste: (currentEditor, files)=>{
|
|
@@ -97,10 +99,10 @@ export const ExtensionKit = ({ dir = "ltr", openAssetHQHandler })=>[
|
|
|
97
99
|
return {};
|
|
98
100
|
}
|
|
99
101
|
}).configure({
|
|
100
|
-
defaultAlignment: dir ===
|
|
102
|
+
defaultAlignment: dir === 'rtl' ? 'right' : 'left',
|
|
101
103
|
types: [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
'heading',
|
|
105
|
+
'paragraph'
|
|
104
106
|
]
|
|
105
107
|
}),
|
|
106
108
|
Subscript,
|
|
@@ -109,7 +111,7 @@ export const ExtensionKit = ({ dir = "ltr", openAssetHQHandler })=>[
|
|
|
109
111
|
Placeholder.configure({
|
|
110
112
|
includeChildren: true,
|
|
111
113
|
showOnlyCurrent: false,
|
|
112
|
-
placeholder: ()=>
|
|
114
|
+
placeholder: ()=>''
|
|
113
115
|
}),
|
|
114
116
|
SlashCommand,
|
|
115
117
|
Focus,
|
|
@@ -117,7 +119,7 @@ export const ExtensionKit = ({ dir = "ltr", openAssetHQHandler })=>[
|
|
|
117
119
|
BlockquoteFigure,
|
|
118
120
|
Dropcursor.configure({
|
|
119
121
|
width: 2,
|
|
120
|
-
class:
|
|
122
|
+
class: 'ProseMirror-dropcursor border-black'
|
|
121
123
|
}),
|
|
122
124
|
History,
|
|
123
125
|
Twitter,
|
|
@@ -130,7 +132,12 @@ export const ExtensionKit = ({ dir = "ltr", openAssetHQHandler })=>[
|
|
|
130
132
|
Iframe,
|
|
131
133
|
AICommand,
|
|
132
134
|
LinkPreview,
|
|
133
|
-
BulletList
|
|
135
|
+
BulletList,
|
|
136
|
+
Table,
|
|
137
|
+
TableRow,
|
|
138
|
+
TableHeader,
|
|
139
|
+
TableCell,
|
|
140
|
+
PasteHandler
|
|
134
141
|
];
|
|
135
142
|
export default ExtensionKit;
|
|
136
143
|
|