@akinon/ui-editor 1.0.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/cjs/__tests__/index.test.d.ts +2 -0
- package/dist/cjs/__tests__/index.test.d.ts.map +1 -0
- package/dist/cjs/__tests__/index.test.js +38 -0
- package/dist/cjs/__tests__/index.test.tsx +51 -0
- package/dist/cjs/i18n/index.d.ts +3 -0
- package/dist/cjs/i18n/index.d.ts.map +1 -0
- package/dist/cjs/i18n/index.js +11 -0
- package/dist/cjs/i18n/translations/en.d.ts +86 -0
- package/dist/cjs/i18n/translations/en.d.ts.map +1 -0
- package/dist/cjs/i18n/translations/en.js +85 -0
- package/dist/cjs/i18n/translations/tr.d.ts +86 -0
- package/dist/cjs/i18n/translations/tr.d.ts.map +1 -0
- package/dist/cjs/i18n/translations/tr.js +85 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +8 -0
- package/dist/cjs/tiptap/assets/__tests__/icons.test.d.ts +2 -0
- package/dist/cjs/tiptap/assets/__tests__/icons.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/assets/__tests__/icons.test.js +25 -0
- package/dist/cjs/tiptap/assets/__tests__/icons.test.tsx +29 -0
- package/dist/cjs/tiptap/assets/icons.d.ts +3 -0
- package/dist/cjs/tiptap/assets/icons.d.ts.map +1 -0
- package/dist/cjs/tiptap/assets/icons.js +3 -0
- package/dist/cjs/tiptap/components/__tests__/format-bubble-menu.test.d.ts +6 -0
- package/dist/cjs/tiptap/components/__tests__/format-bubble-menu.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/__tests__/format-bubble-menu.test.js +311 -0
- package/dist/cjs/tiptap/components/__tests__/format-bubble-menu.test.tsx +452 -0
- package/dist/cjs/tiptap/components/__tests__/html-code-viewer.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/__tests__/html-code-viewer.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/__tests__/html-code-viewer.test.js +89 -0
- package/dist/cjs/tiptap/components/__tests__/html-code-viewer.test.tsx +126 -0
- package/dist/cjs/tiptap/components/__tests__/image-upload-placeholder.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/__tests__/image-upload-placeholder.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/__tests__/image-upload-placeholder.test.js +206 -0
- package/dist/cjs/tiptap/components/__tests__/image-upload-placeholder.test.tsx +297 -0
- package/dist/cjs/tiptap/components/__tests__/secure-script-component.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/__tests__/secure-script-component.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/__tests__/secure-script-component.test.js +57 -0
- package/dist/cjs/tiptap/components/__tests__/secure-script-component.test.tsx +89 -0
- package/dist/cjs/tiptap/components/__tests__/table-bubble-menu.test.d.ts +6 -0
- package/dist/cjs/tiptap/components/__tests__/table-bubble-menu.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/__tests__/table-bubble-menu.test.js +284 -0
- package/dist/cjs/tiptap/components/__tests__/table-bubble-menu.test.tsx +466 -0
- package/dist/cjs/tiptap/components/__tests__/table-popover.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/__tests__/table-popover.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/__tests__/table-popover.test.js +101 -0
- package/dist/cjs/tiptap/components/__tests__/table-popover.test.tsx +157 -0
- package/dist/cjs/tiptap/components/__tests__/tiptap.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/__tests__/tiptap.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/__tests__/tiptap.test.js +275 -0
- package/dist/cjs/tiptap/components/__tests__/tiptap.test.tsx +378 -0
- package/dist/cjs/tiptap/components/format-bubble-menu.d.ts +8 -0
- package/dist/cjs/tiptap/components/format-bubble-menu.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/format-bubble-menu.js +202 -0
- package/dist/cjs/tiptap/components/html-code-viewer.d.ts +10 -0
- package/dist/cjs/tiptap/components/html-code-viewer.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/html-code-viewer.js +96 -0
- package/dist/cjs/tiptap/components/image-upload-placeholder.d.ts +4 -0
- package/dist/cjs/tiptap/components/image-upload-placeholder.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/image-upload-placeholder.js +94 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/action-toolbar.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/action-toolbar.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/action-toolbar.test.js +78 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/action-toolbar.test.tsx +212 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/alignment-toolbar.test.d.ts +3 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/alignment-toolbar.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/alignment-toolbar.test.js +201 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/alignment-toolbar.test.tsx +411 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/heading-selector.test.d.ts +4 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/heading-selector.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/heading-selector.test.js +242 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/heading-selector.test.tsx +569 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/index.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/index.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/index.test.js +236 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/index.test.tsx +325 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/link-popover.test.d.ts +3 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/link-popover.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/link-popover.test.js +332 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/link-popover.test.tsx +648 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/list-and-block-toolbar.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/list-and-block-toolbar.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/list-and-block-toolbar.test.js +196 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/list-and-block-toolbar.test.tsx +414 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/media-toolbar.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/media-toolbar.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/media-toolbar.test.js +74 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/media-toolbar.test.tsx +206 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/text-formatting-toolbar.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/text-formatting-toolbar.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/text-formatting-toolbar.test.js +265 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/text-formatting-toolbar.test.tsx +575 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/youtube-popover.test.d.ts +3 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/youtube-popover.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/youtube-popover.test.js +277 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/youtube-popover.test.tsx +538 -0
- package/dist/cjs/tiptap/components/menu-bar/action-toolbar.d.ts +15 -0
- package/dist/cjs/tiptap/components/menu-bar/action-toolbar.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/action-toolbar.js +40 -0
- package/dist/cjs/tiptap/components/menu-bar/alignment-toolbar.d.ts +12 -0
- package/dist/cjs/tiptap/components/menu-bar/alignment-toolbar.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/alignment-toolbar.js +39 -0
- package/dist/cjs/tiptap/components/menu-bar/heading-selector.d.ts +16 -0
- package/dist/cjs/tiptap/components/menu-bar/heading-selector.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/heading-selector.js +70 -0
- package/dist/cjs/tiptap/components/menu-bar/index.d.ts +18 -0
- package/dist/cjs/tiptap/components/menu-bar/index.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/index.js +131 -0
- package/dist/cjs/tiptap/components/menu-bar/link-popover.d.ts +12 -0
- package/dist/cjs/tiptap/components/menu-bar/link-popover.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/link-popover.js +108 -0
- package/dist/cjs/tiptap/components/menu-bar/list-and-block-toolbar.d.ts +18 -0
- package/dist/cjs/tiptap/components/menu-bar/list-and-block-toolbar.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/list-and-block-toolbar.js +69 -0
- package/dist/cjs/tiptap/components/menu-bar/media-toolbar.d.ts +13 -0
- package/dist/cjs/tiptap/components/menu-bar/media-toolbar.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/media-toolbar.js +15 -0
- package/dist/cjs/tiptap/components/menu-bar/text-formatting-toolbar.d.ts +18 -0
- package/dist/cjs/tiptap/components/menu-bar/text-formatting-toolbar.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/text-formatting-toolbar.js +87 -0
- package/dist/cjs/tiptap/components/menu-bar/youtube-popover.d.ts +12 -0
- package/dist/cjs/tiptap/components/menu-bar/youtube-popover.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/youtube-popover.js +70 -0
- package/dist/cjs/tiptap/components/secure-script-component.d.ts +3 -0
- package/dist/cjs/tiptap/components/secure-script-component.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/secure-script-component.js +61 -0
- package/dist/cjs/tiptap/components/table-bubble-menu.d.ts +9 -0
- package/dist/cjs/tiptap/components/table-bubble-menu.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/table-bubble-menu.js +274 -0
- package/dist/cjs/tiptap/components/table-popover.d.ts +10 -0
- package/dist/cjs/tiptap/components/table-popover.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/table-popover.js +86 -0
- package/dist/cjs/tiptap/components/tiptap.d.ts +4 -0
- package/dist/cjs/tiptap/components/tiptap.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/tiptap.js +311 -0
- package/dist/cjs/tiptap/constants/__tests__/table-defaults.test.d.ts +2 -0
- package/dist/cjs/tiptap/constants/__tests__/table-defaults.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/constants/__tests__/table-defaults.test.js +56 -0
- package/dist/cjs/tiptap/constants/__tests__/table-defaults.test.ts +69 -0
- package/dist/cjs/tiptap/constants/editor-config.d.ts +89 -0
- package/dist/cjs/tiptap/constants/editor-config.d.ts.map +1 -0
- package/dist/cjs/tiptap/constants/editor-config.js +103 -0
- package/dist/cjs/tiptap/constants/html-elements.d.ts +95 -0
- package/dist/cjs/tiptap/constants/html-elements.d.ts.map +1 -0
- package/dist/cjs/tiptap/constants/html-elements.js +158 -0
- package/dist/cjs/tiptap/constants/index.d.ts +4 -0
- package/dist/cjs/tiptap/constants/index.d.ts.map +1 -0
- package/dist/cjs/tiptap/constants/index.js +3 -0
- package/dist/cjs/tiptap/constants/table-defaults.d.ts +14 -0
- package/dist/cjs/tiptap/constants/table-defaults.d.ts.map +1 -0
- package/dist/cjs/tiptap/constants/table-defaults.js +18 -0
- package/dist/cjs/tiptap/extensions/__tests__/comment-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/comment-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/comment-extension.test.js +75 -0
- package/dist/cjs/tiptap/extensions/__tests__/comment-extension.test.ts +84 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-cell-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-cell-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-cell-extension.test.js +116 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-cell-extension.test.ts +147 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-cell-extension.test.tsx +90 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-header-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-header-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-header-extension.test.js +183 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-header-extension.test.ts +213 -0
- package/dist/cjs/tiptap/extensions/__tests__/html-block-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/html-block-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/html-block-extension.test.js +103 -0
- package/dist/cjs/tiptap/extensions/__tests__/html-block-extension.test.ts +117 -0
- package/dist/cjs/tiptap/extensions/__tests__/html-inline-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/html-inline-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/html-inline-extension.test.js +105 -0
- package/dist/cjs/tiptap/extensions/__tests__/html-inline-extension.test.ts +119 -0
- package/dist/cjs/tiptap/extensions/__tests__/iframe-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/iframe-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/iframe-extension.test.js +262 -0
- package/dist/cjs/tiptap/extensions/__tests__/iframe-extension.test.ts +297 -0
- package/dist/cjs/tiptap/extensions/__tests__/image-upload-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/image-upload-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/image-upload-extension.test.js +52 -0
- package/dist/cjs/tiptap/extensions/__tests__/image-upload-extension.test.tsx +65 -0
- package/dist/cjs/tiptap/extensions/__tests__/index.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/index.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/index.test.js +24 -0
- package/dist/cjs/tiptap/extensions/__tests__/index.test.ts +26 -0
- package/dist/cjs/tiptap/extensions/__tests__/reset-marks-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/reset-marks-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/reset-marks-extension.test.js +53 -0
- package/dist/cjs/tiptap/extensions/__tests__/reset-marks-extension.test.ts +74 -0
- package/dist/cjs/tiptap/extensions/__tests__/secure-script-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/secure-script-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/secure-script-extension.test.js +27 -0
- package/dist/cjs/tiptap/extensions/__tests__/secure-script-extension.test.tsx +32 -0
- package/dist/cjs/tiptap/extensions/comment-extension.d.ts +13 -0
- package/dist/cjs/tiptap/extensions/comment-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/comment-extension.js +47 -0
- package/dist/cjs/tiptap/extensions/custom-table-cell-extension.d.ts +10 -0
- package/dist/cjs/tiptap/extensions/custom-table-cell-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/custom-table-cell-extension.js +64 -0
- package/dist/cjs/tiptap/extensions/custom-table-header-extension.d.ts +10 -0
- package/dist/cjs/tiptap/extensions/custom-table-header-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/custom-table-header-extension.js +63 -0
- package/dist/cjs/tiptap/extensions/html-block-extension.d.ts +6 -0
- package/dist/cjs/tiptap/extensions/html-block-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/html-block-extension.js +90 -0
- package/dist/cjs/tiptap/extensions/html-inline-extension.d.ts +6 -0
- package/dist/cjs/tiptap/extensions/html-inline-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/html-inline-extension.js +87 -0
- package/dist/cjs/tiptap/extensions/iframe-extension.d.ts +18 -0
- package/dist/cjs/tiptap/extensions/iframe-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/iframe-extension.js +170 -0
- package/dist/cjs/tiptap/extensions/image-upload-extension.d.ts +3 -0
- package/dist/cjs/tiptap/extensions/image-upload-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/image-upload-extension.js +29 -0
- package/dist/cjs/tiptap/extensions/index.d.ts +10 -0
- package/dist/cjs/tiptap/extensions/index.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/index.js +9 -0
- package/dist/cjs/tiptap/extensions/reset-marks-extension.d.ts +3 -0
- package/dist/cjs/tiptap/extensions/reset-marks-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/reset-marks-extension.js +17 -0
- package/dist/cjs/tiptap/extensions/secure-script-extension.d.ts +3 -0
- package/dist/cjs/tiptap/extensions/secure-script-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/secure-script-extension.js +55 -0
- package/dist/cjs/tiptap/types/index.d.ts +232 -0
- package/dist/cjs/tiptap/types/index.d.ts.map +1 -0
- package/dist/cjs/tiptap/types/index.js +1 -0
- package/dist/cjs/tiptap/utils/__tests__/format-html.test.d.ts +2 -0
- package/dist/cjs/tiptap/utils/__tests__/format-html.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/__tests__/format-html.test.js +68 -0
- package/dist/cjs/tiptap/utils/__tests__/format-html.test.ts +91 -0
- package/dist/cjs/tiptap/utils/__tests__/highlight-html.test.d.ts +2 -0
- package/dist/cjs/tiptap/utils/__tests__/highlight-html.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/__tests__/highlight-html.test.js +71 -0
- package/dist/cjs/tiptap/utils/__tests__/highlight-html.test.ts +100 -0
- package/dist/cjs/tiptap/utils/__tests__/index.test.d.ts +2 -0
- package/dist/cjs/tiptap/utils/__tests__/index.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/__tests__/index.test.js +13 -0
- package/dist/cjs/tiptap/utils/__tests__/index.test.ts +15 -0
- package/dist/cjs/tiptap/utils/__tests__/normalize-html.test.d.ts +2 -0
- package/dist/cjs/tiptap/utils/__tests__/normalize-html.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/__tests__/normalize-html.test.js +53 -0
- package/dist/cjs/tiptap/utils/__tests__/normalize-html.test.ts +77 -0
- package/dist/cjs/tiptap/utils/__tests__/tiptap-extensions.test.d.ts +2 -0
- package/dist/cjs/tiptap/utils/__tests__/tiptap-extensions.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/__tests__/tiptap-extensions.test.js +209 -0
- package/dist/cjs/tiptap/utils/__tests__/tiptap-extensions.test.ts +299 -0
- package/dist/cjs/tiptap/utils/format-html.d.ts +6 -0
- package/dist/cjs/tiptap/utils/format-html.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/format-html.js +108 -0
- package/dist/cjs/tiptap/utils/highlight-html.d.ts +6 -0
- package/dist/cjs/tiptap/utils/highlight-html.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/highlight-html.js +82 -0
- package/dist/cjs/tiptap/utils/index.d.ts +5 -0
- package/dist/cjs/tiptap/utils/index.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/index.js +4 -0
- package/dist/cjs/tiptap/utils/normalize-html.d.ts +7 -0
- package/dist/cjs/tiptap/utils/normalize-html.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/normalize-html.js +109 -0
- package/dist/cjs/tiptap/utils/tiptap-extensions.d.ts +21 -0
- package/dist/cjs/tiptap/utils/tiptap-extensions.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/tiptap-extensions.js +198 -0
- package/dist/esm/__tests__/index.test.d.ts +2 -0
- package/dist/esm/__tests__/index.test.d.ts.map +1 -0
- package/dist/esm/__tests__/index.test.js +38 -0
- package/dist/esm/__tests__/index.test.tsx +51 -0
- package/dist/esm/i18n/index.d.ts +3 -0
- package/dist/esm/i18n/index.d.ts.map +1 -0
- package/dist/esm/i18n/index.js +11 -0
- package/dist/esm/i18n/translations/en.d.ts +86 -0
- package/dist/esm/i18n/translations/en.d.ts.map +1 -0
- package/dist/esm/i18n/translations/en.js +85 -0
- package/dist/esm/i18n/translations/tr.d.ts +86 -0
- package/dist/esm/i18n/translations/tr.d.ts.map +1 -0
- package/dist/esm/i18n/translations/tr.js +85 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/tiptap/assets/__tests__/icons.test.d.ts +2 -0
- package/dist/esm/tiptap/assets/__tests__/icons.test.d.ts.map +1 -0
- package/dist/esm/tiptap/assets/__tests__/icons.test.js +25 -0
- package/dist/esm/tiptap/assets/__tests__/icons.test.tsx +29 -0
- package/dist/esm/tiptap/assets/icons.d.ts +3 -0
- package/dist/esm/tiptap/assets/icons.d.ts.map +1 -0
- package/dist/esm/tiptap/assets/icons.js +3 -0
- package/dist/esm/tiptap/components/__tests__/format-bubble-menu.test.d.ts +6 -0
- package/dist/esm/tiptap/components/__tests__/format-bubble-menu.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/__tests__/format-bubble-menu.test.js +311 -0
- package/dist/esm/tiptap/components/__tests__/format-bubble-menu.test.tsx +452 -0
- package/dist/esm/tiptap/components/__tests__/html-code-viewer.test.d.ts +2 -0
- package/dist/esm/tiptap/components/__tests__/html-code-viewer.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/__tests__/html-code-viewer.test.js +89 -0
- package/dist/esm/tiptap/components/__tests__/html-code-viewer.test.tsx +126 -0
- package/dist/esm/tiptap/components/__tests__/image-upload-placeholder.test.d.ts +2 -0
- package/dist/esm/tiptap/components/__tests__/image-upload-placeholder.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/__tests__/image-upload-placeholder.test.js +206 -0
- package/dist/esm/tiptap/components/__tests__/image-upload-placeholder.test.tsx +297 -0
- package/dist/esm/tiptap/components/__tests__/secure-script-component.test.d.ts +2 -0
- package/dist/esm/tiptap/components/__tests__/secure-script-component.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/__tests__/secure-script-component.test.js +57 -0
- package/dist/esm/tiptap/components/__tests__/secure-script-component.test.tsx +89 -0
- package/dist/esm/tiptap/components/__tests__/table-bubble-menu.test.d.ts +6 -0
- package/dist/esm/tiptap/components/__tests__/table-bubble-menu.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/__tests__/table-bubble-menu.test.js +284 -0
- package/dist/esm/tiptap/components/__tests__/table-bubble-menu.test.tsx +466 -0
- package/dist/esm/tiptap/components/__tests__/table-popover.test.d.ts +2 -0
- package/dist/esm/tiptap/components/__tests__/table-popover.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/__tests__/table-popover.test.js +101 -0
- package/dist/esm/tiptap/components/__tests__/table-popover.test.tsx +157 -0
- package/dist/esm/tiptap/components/__tests__/tiptap.test.d.ts +2 -0
- package/dist/esm/tiptap/components/__tests__/tiptap.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/__tests__/tiptap.test.js +275 -0
- package/dist/esm/tiptap/components/__tests__/tiptap.test.tsx +378 -0
- package/dist/esm/tiptap/components/format-bubble-menu.d.ts +8 -0
- package/dist/esm/tiptap/components/format-bubble-menu.d.ts.map +1 -0
- package/dist/esm/tiptap/components/format-bubble-menu.js +202 -0
- package/dist/esm/tiptap/components/html-code-viewer.d.ts +10 -0
- package/dist/esm/tiptap/components/html-code-viewer.d.ts.map +1 -0
- package/dist/esm/tiptap/components/html-code-viewer.js +96 -0
- package/dist/esm/tiptap/components/image-upload-placeholder.d.ts +4 -0
- package/dist/esm/tiptap/components/image-upload-placeholder.d.ts.map +1 -0
- package/dist/esm/tiptap/components/image-upload-placeholder.js +94 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/action-toolbar.test.d.ts +2 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/action-toolbar.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/action-toolbar.test.js +78 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/action-toolbar.test.tsx +212 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/alignment-toolbar.test.d.ts +3 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/alignment-toolbar.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/alignment-toolbar.test.js +201 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/alignment-toolbar.test.tsx +411 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/heading-selector.test.d.ts +4 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/heading-selector.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/heading-selector.test.js +242 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/heading-selector.test.tsx +569 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/index.test.d.ts +2 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/index.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/index.test.js +236 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/index.test.tsx +325 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/link-popover.test.d.ts +3 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/link-popover.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/link-popover.test.js +332 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/link-popover.test.tsx +648 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/list-and-block-toolbar.test.d.ts +2 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/list-and-block-toolbar.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/list-and-block-toolbar.test.js +196 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/list-and-block-toolbar.test.tsx +414 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/media-toolbar.test.d.ts +2 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/media-toolbar.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/media-toolbar.test.js +74 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/media-toolbar.test.tsx +206 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/text-formatting-toolbar.test.d.ts +2 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/text-formatting-toolbar.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/text-formatting-toolbar.test.js +265 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/text-formatting-toolbar.test.tsx +575 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/youtube-popover.test.d.ts +3 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/youtube-popover.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/youtube-popover.test.js +277 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/youtube-popover.test.tsx +538 -0
- package/dist/esm/tiptap/components/menu-bar/action-toolbar.d.ts +15 -0
- package/dist/esm/tiptap/components/menu-bar/action-toolbar.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/action-toolbar.js +40 -0
- package/dist/esm/tiptap/components/menu-bar/alignment-toolbar.d.ts +12 -0
- package/dist/esm/tiptap/components/menu-bar/alignment-toolbar.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/alignment-toolbar.js +39 -0
- package/dist/esm/tiptap/components/menu-bar/heading-selector.d.ts +16 -0
- package/dist/esm/tiptap/components/menu-bar/heading-selector.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/heading-selector.js +70 -0
- package/dist/esm/tiptap/components/menu-bar/index.d.ts +18 -0
- package/dist/esm/tiptap/components/menu-bar/index.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/index.js +131 -0
- package/dist/esm/tiptap/components/menu-bar/link-popover.d.ts +12 -0
- package/dist/esm/tiptap/components/menu-bar/link-popover.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/link-popover.js +108 -0
- package/dist/esm/tiptap/components/menu-bar/list-and-block-toolbar.d.ts +18 -0
- package/dist/esm/tiptap/components/menu-bar/list-and-block-toolbar.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/list-and-block-toolbar.js +69 -0
- package/dist/esm/tiptap/components/menu-bar/media-toolbar.d.ts +13 -0
- package/dist/esm/tiptap/components/menu-bar/media-toolbar.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/media-toolbar.js +15 -0
- package/dist/esm/tiptap/components/menu-bar/text-formatting-toolbar.d.ts +18 -0
- package/dist/esm/tiptap/components/menu-bar/text-formatting-toolbar.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/text-formatting-toolbar.js +87 -0
- package/dist/esm/tiptap/components/menu-bar/youtube-popover.d.ts +12 -0
- package/dist/esm/tiptap/components/menu-bar/youtube-popover.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/youtube-popover.js +70 -0
- package/dist/esm/tiptap/components/secure-script-component.d.ts +3 -0
- package/dist/esm/tiptap/components/secure-script-component.d.ts.map +1 -0
- package/dist/esm/tiptap/components/secure-script-component.js +61 -0
- package/dist/esm/tiptap/components/table-bubble-menu.d.ts +9 -0
- package/dist/esm/tiptap/components/table-bubble-menu.d.ts.map +1 -0
- package/dist/esm/tiptap/components/table-bubble-menu.js +274 -0
- package/dist/esm/tiptap/components/table-popover.d.ts +10 -0
- package/dist/esm/tiptap/components/table-popover.d.ts.map +1 -0
- package/dist/esm/tiptap/components/table-popover.js +86 -0
- package/dist/esm/tiptap/components/tiptap.d.ts +4 -0
- package/dist/esm/tiptap/components/tiptap.d.ts.map +1 -0
- package/dist/esm/tiptap/components/tiptap.js +311 -0
- package/dist/esm/tiptap/constants/__tests__/table-defaults.test.d.ts +2 -0
- package/dist/esm/tiptap/constants/__tests__/table-defaults.test.d.ts.map +1 -0
- package/dist/esm/tiptap/constants/__tests__/table-defaults.test.js +56 -0
- package/dist/esm/tiptap/constants/__tests__/table-defaults.test.ts +69 -0
- package/dist/esm/tiptap/constants/editor-config.d.ts +89 -0
- package/dist/esm/tiptap/constants/editor-config.d.ts.map +1 -0
- package/dist/esm/tiptap/constants/editor-config.js +103 -0
- package/dist/esm/tiptap/constants/html-elements.d.ts +95 -0
- package/dist/esm/tiptap/constants/html-elements.d.ts.map +1 -0
- package/dist/esm/tiptap/constants/html-elements.js +158 -0
- package/dist/esm/tiptap/constants/index.d.ts +4 -0
- package/dist/esm/tiptap/constants/index.d.ts.map +1 -0
- package/dist/esm/tiptap/constants/index.js +3 -0
- package/dist/esm/tiptap/constants/table-defaults.d.ts +14 -0
- package/dist/esm/tiptap/constants/table-defaults.d.ts.map +1 -0
- package/dist/esm/tiptap/constants/table-defaults.js +18 -0
- package/dist/esm/tiptap/extensions/__tests__/comment-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/comment-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/comment-extension.test.js +75 -0
- package/dist/esm/tiptap/extensions/__tests__/comment-extension.test.ts +84 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-cell-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-cell-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-cell-extension.test.js +116 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-cell-extension.test.ts +147 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-cell-extension.test.tsx +90 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-header-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-header-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-header-extension.test.js +183 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-header-extension.test.ts +213 -0
- package/dist/esm/tiptap/extensions/__tests__/html-block-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/html-block-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/html-block-extension.test.js +103 -0
- package/dist/esm/tiptap/extensions/__tests__/html-block-extension.test.ts +117 -0
- package/dist/esm/tiptap/extensions/__tests__/html-inline-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/html-inline-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/html-inline-extension.test.js +105 -0
- package/dist/esm/tiptap/extensions/__tests__/html-inline-extension.test.ts +119 -0
- package/dist/esm/tiptap/extensions/__tests__/iframe-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/iframe-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/iframe-extension.test.js +262 -0
- package/dist/esm/tiptap/extensions/__tests__/iframe-extension.test.ts +297 -0
- package/dist/esm/tiptap/extensions/__tests__/image-upload-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/image-upload-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/image-upload-extension.test.js +52 -0
- package/dist/esm/tiptap/extensions/__tests__/image-upload-extension.test.tsx +65 -0
- package/dist/esm/tiptap/extensions/__tests__/index.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/index.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/index.test.js +24 -0
- package/dist/esm/tiptap/extensions/__tests__/index.test.ts +26 -0
- package/dist/esm/tiptap/extensions/__tests__/reset-marks-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/reset-marks-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/reset-marks-extension.test.js +53 -0
- package/dist/esm/tiptap/extensions/__tests__/reset-marks-extension.test.ts +74 -0
- package/dist/esm/tiptap/extensions/__tests__/secure-script-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/secure-script-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/secure-script-extension.test.js +27 -0
- package/dist/esm/tiptap/extensions/__tests__/secure-script-extension.test.tsx +32 -0
- package/dist/esm/tiptap/extensions/comment-extension.d.ts +13 -0
- package/dist/esm/tiptap/extensions/comment-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/comment-extension.js +47 -0
- package/dist/esm/tiptap/extensions/custom-table-cell-extension.d.ts +10 -0
- package/dist/esm/tiptap/extensions/custom-table-cell-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/custom-table-cell-extension.js +64 -0
- package/dist/esm/tiptap/extensions/custom-table-header-extension.d.ts +10 -0
- package/dist/esm/tiptap/extensions/custom-table-header-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/custom-table-header-extension.js +63 -0
- package/dist/esm/tiptap/extensions/html-block-extension.d.ts +6 -0
- package/dist/esm/tiptap/extensions/html-block-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/html-block-extension.js +90 -0
- package/dist/esm/tiptap/extensions/html-inline-extension.d.ts +6 -0
- package/dist/esm/tiptap/extensions/html-inline-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/html-inline-extension.js +87 -0
- package/dist/esm/tiptap/extensions/iframe-extension.d.ts +18 -0
- package/dist/esm/tiptap/extensions/iframe-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/iframe-extension.js +170 -0
- package/dist/esm/tiptap/extensions/image-upload-extension.d.ts +3 -0
- package/dist/esm/tiptap/extensions/image-upload-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/image-upload-extension.js +29 -0
- package/dist/esm/tiptap/extensions/index.d.ts +10 -0
- package/dist/esm/tiptap/extensions/index.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/index.js +9 -0
- package/dist/esm/tiptap/extensions/reset-marks-extension.d.ts +3 -0
- package/dist/esm/tiptap/extensions/reset-marks-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/reset-marks-extension.js +17 -0
- package/dist/esm/tiptap/extensions/secure-script-extension.d.ts +3 -0
- package/dist/esm/tiptap/extensions/secure-script-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/secure-script-extension.js +55 -0
- package/dist/esm/tiptap/types/index.d.ts +232 -0
- package/dist/esm/tiptap/types/index.d.ts.map +1 -0
- package/dist/esm/tiptap/types/index.js +1 -0
- package/dist/esm/tiptap/utils/__tests__/format-html.test.d.ts +2 -0
- package/dist/esm/tiptap/utils/__tests__/format-html.test.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/__tests__/format-html.test.js +68 -0
- package/dist/esm/tiptap/utils/__tests__/format-html.test.ts +91 -0
- package/dist/esm/tiptap/utils/__tests__/highlight-html.test.d.ts +2 -0
- package/dist/esm/tiptap/utils/__tests__/highlight-html.test.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/__tests__/highlight-html.test.js +71 -0
- package/dist/esm/tiptap/utils/__tests__/highlight-html.test.ts +100 -0
- package/dist/esm/tiptap/utils/__tests__/index.test.d.ts +2 -0
- package/dist/esm/tiptap/utils/__tests__/index.test.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/__tests__/index.test.js +13 -0
- package/dist/esm/tiptap/utils/__tests__/index.test.ts +15 -0
- package/dist/esm/tiptap/utils/__tests__/normalize-html.test.d.ts +2 -0
- package/dist/esm/tiptap/utils/__tests__/normalize-html.test.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/__tests__/normalize-html.test.js +53 -0
- package/dist/esm/tiptap/utils/__tests__/normalize-html.test.ts +77 -0
- package/dist/esm/tiptap/utils/__tests__/tiptap-extensions.test.d.ts +2 -0
- package/dist/esm/tiptap/utils/__tests__/tiptap-extensions.test.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/__tests__/tiptap-extensions.test.js +209 -0
- package/dist/esm/tiptap/utils/__tests__/tiptap-extensions.test.ts +299 -0
- package/dist/esm/tiptap/utils/format-html.d.ts +6 -0
- package/dist/esm/tiptap/utils/format-html.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/format-html.js +108 -0
- package/dist/esm/tiptap/utils/highlight-html.d.ts +6 -0
- package/dist/esm/tiptap/utils/highlight-html.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/highlight-html.js +82 -0
- package/dist/esm/tiptap/utils/index.d.ts +5 -0
- package/dist/esm/tiptap/utils/index.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/index.js +4 -0
- package/dist/esm/tiptap/utils/normalize-html.d.ts +7 -0
- package/dist/esm/tiptap/utils/normalize-html.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/normalize-html.js +109 -0
- package/dist/esm/tiptap/utils/tiptap-extensions.d.ts +21 -0
- package/dist/esm/tiptap/utils/tiptap-extensions.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/tiptap-extensions.js +198 -0
- package/package.json +99 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple HTML syntax highlighter without external dependencies
|
|
3
|
+
* Tokenizes HTML and wraps tokens in spans for styling
|
|
4
|
+
*/
|
|
5
|
+
const CLASSES = {
|
|
6
|
+
COMMENT: 'html-comment',
|
|
7
|
+
DOCTYPE: 'html-doctype',
|
|
8
|
+
TAG: 'html-tag',
|
|
9
|
+
ATTR: 'html-attr',
|
|
10
|
+
VALUE: 'html-value',
|
|
11
|
+
STRING: 'html-string'
|
|
12
|
+
};
|
|
13
|
+
const REGEX = {
|
|
14
|
+
// Matches HTML tags, comments, doctypes
|
|
15
|
+
TOKEN: /((?:<!--[\s\S]*?-->)|(?:<!DOCTYPE[^>]*>)|(?:<\/?[\w-]+(?:(?:\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)\/?>))/gi,
|
|
16
|
+
COMMENT: /^<!--/,
|
|
17
|
+
DOCTYPE: /^<!DOCTYPE/i,
|
|
18
|
+
TAG_START: /^<\/?/,
|
|
19
|
+
// parse tag: 1=openBracket, 2=tagName, 3=attributes, 4=closeBracket
|
|
20
|
+
TAG_PARSE: /(<\/?)([\w-]+)((?:\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?>)/g,
|
|
21
|
+
// parse attributes: 1=name, 2=equals, 3=fullValue, 4=doubleQ, 5=singleQ, 6=unquoted
|
|
22
|
+
// parse attributes: 1=name, 2=equals, 3=fullValue, 4=doubleQ, 5=singleQ, 6=unquoted
|
|
23
|
+
ATTR_PARSE: /([\w-]+)(?:(=)("([^"]*)"|'([^']*)'|([^\s>]*)))?/g,
|
|
24
|
+
STRING_LITERAL: /(".*?"|'.*?')/g
|
|
25
|
+
};
|
|
26
|
+
export const highlightHtml = (html) => {
|
|
27
|
+
const tokens = html.split(REGEX.TOKEN);
|
|
28
|
+
return tokens.map(processToken).join('');
|
|
29
|
+
};
|
|
30
|
+
const processToken = (token) => {
|
|
31
|
+
if (REGEX.COMMENT.test(token)) {
|
|
32
|
+
return wrapInSpan(escapeHtml(token), CLASSES.COMMENT);
|
|
33
|
+
}
|
|
34
|
+
if (REGEX.DOCTYPE.test(token)) {
|
|
35
|
+
return wrapInSpan(escapeHtml(token), CLASSES.DOCTYPE);
|
|
36
|
+
}
|
|
37
|
+
if (REGEX.TAG_START.test(token)) {
|
|
38
|
+
return processTag(token);
|
|
39
|
+
}
|
|
40
|
+
return processText(token);
|
|
41
|
+
};
|
|
42
|
+
const processTag = (token) => {
|
|
43
|
+
const escapedToken = escapeHtml(token);
|
|
44
|
+
return escapedToken.replace(REGEX.TAG_PARSE, (_, openBracket, tagName, attributes, closeBracket) => {
|
|
45
|
+
let result = `${openBracket}${wrapInSpan(tagName, CLASSES.TAG)}`;
|
|
46
|
+
if (attributes) {
|
|
47
|
+
result += processAttributes(attributes);
|
|
48
|
+
}
|
|
49
|
+
result += closeBracket;
|
|
50
|
+
return result;
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
const processAttributes = (attributes) => {
|
|
54
|
+
return attributes.replace(REGEX.ATTR_PARSE, (_match, attrName, equals, _fullValue, doubleQuoted, singleQuoted, unquoted) => {
|
|
55
|
+
const nameSpan = wrapInSpan(attrName, CLASSES.ATTR);
|
|
56
|
+
if (!equals) {
|
|
57
|
+
return nameSpan;
|
|
58
|
+
}
|
|
59
|
+
let formattedValue = '';
|
|
60
|
+
if (doubleQuoted !== undefined) {
|
|
61
|
+
formattedValue = `"${doubleQuoted}"`;
|
|
62
|
+
}
|
|
63
|
+
else if (singleQuoted !== undefined) {
|
|
64
|
+
formattedValue = `'${singleQuoted}'`;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
formattedValue = unquoted || '';
|
|
68
|
+
}
|
|
69
|
+
const valueSpan = wrapInSpan(formattedValue, CLASSES.VALUE);
|
|
70
|
+
return `${nameSpan}${equals}${valueSpan}`;
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
const processText = (token) => {
|
|
74
|
+
const escaped = escapeHtml(token);
|
|
75
|
+
return escaped.replace(REGEX.STRING_LITERAL, match => `<span class="${CLASSES.STRING}">${match}</span>`);
|
|
76
|
+
};
|
|
77
|
+
const escapeHtml = (str) => {
|
|
78
|
+
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
79
|
+
};
|
|
80
|
+
const wrapInSpan = (content, className) => {
|
|
81
|
+
return `<span class="${className}">${content}</span>`;
|
|
82
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tiptap/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes HTML by removing formatting whitespace (newlines and indentation)
|
|
3
|
+
* while preserving meaningful whitespace within text content.
|
|
4
|
+
* Used when converting from source mode back to visual editor.
|
|
5
|
+
*/
|
|
6
|
+
export declare const normalizeHtml: (html: string) => string;
|
|
7
|
+
//# sourceMappingURL=normalize-html.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-html.d.ts","sourceRoot":"","sources":["../../../../src/tiptap/utils/normalize-html.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,MAY5C,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { HTML_ELEMENTS } from '../constants';
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes HTML by removing formatting whitespace (newlines and indentation)
|
|
4
|
+
* while preserving meaningful whitespace within text content.
|
|
5
|
+
* Used when converting from source mode back to visual editor.
|
|
6
|
+
*/
|
|
7
|
+
export const normalizeHtml = (html) => {
|
|
8
|
+
const div = document.createElement(HTML_ELEMENTS.DIV);
|
|
9
|
+
div.innerHTML = html;
|
|
10
|
+
cleanScriptsAndStyles(div);
|
|
11
|
+
convertCommentsToSpans(div);
|
|
12
|
+
unwrapHrFromParagraphs(div);
|
|
13
|
+
flattenEmptyParagraphs(div);
|
|
14
|
+
mergeConsecutiveBreaks(div);
|
|
15
|
+
mergeConsecutiveBreaks(div);
|
|
16
|
+
return div.innerHTML;
|
|
17
|
+
};
|
|
18
|
+
const convertCommentsToSpans = (root) => {
|
|
19
|
+
const iterator = document.createNodeIterator(root, NodeFilter.SHOW_COMMENT, null);
|
|
20
|
+
let currentNode;
|
|
21
|
+
const comments = [];
|
|
22
|
+
while ((currentNode = iterator.nextNode())) {
|
|
23
|
+
comments.push(currentNode);
|
|
24
|
+
}
|
|
25
|
+
comments.forEach(comment => {
|
|
26
|
+
var _a;
|
|
27
|
+
const span = document.createElement(HTML_ELEMENTS.SPAN);
|
|
28
|
+
span.setAttribute('data-type', 'comment');
|
|
29
|
+
span.setAttribute('data-content', comment.textContent || '');
|
|
30
|
+
(_a = comment.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(span, comment);
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const cleanScriptsAndStyles = (root) => {
|
|
34
|
+
const scripts = root.querySelectorAll(`${HTML_ELEMENTS.SCRIPT}, ${HTML_ELEMENTS.STYLE}`);
|
|
35
|
+
scripts.forEach(el => {
|
|
36
|
+
const content = el.textContent;
|
|
37
|
+
if (content && content.trim()) {
|
|
38
|
+
el.textContent = dedent(content);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
const unwrapHrFromParagraphs = (root) => {
|
|
43
|
+
const hrs = root.querySelectorAll(HTML_ELEMENTS.HR);
|
|
44
|
+
hrs.forEach(hr => {
|
|
45
|
+
var _a;
|
|
46
|
+
const parent = hr.parentElement;
|
|
47
|
+
if (parent && parent.tagName.toLowerCase() === HTML_ELEMENTS.P) {
|
|
48
|
+
// If HR is the only child (or only meaningful child), replace the p with hr
|
|
49
|
+
const siblings = Array.from(parent.childNodes).filter(node => {
|
|
50
|
+
var _a;
|
|
51
|
+
return node !== hr &&
|
|
52
|
+
!(node.nodeType === Node.TEXT_NODE && !((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.trim()));
|
|
53
|
+
});
|
|
54
|
+
if (siblings.length === 0) {
|
|
55
|
+
(_a = parent.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(hr, parent);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
const flattenEmptyParagraphs = (root) => {
|
|
61
|
+
// Remove empty paragraphs that only contain <br>
|
|
62
|
+
const paragraphs = root.querySelectorAll(HTML_ELEMENTS.P);
|
|
63
|
+
paragraphs.forEach(p => {
|
|
64
|
+
var _a;
|
|
65
|
+
const hasOnlyBrOrWhitespace = Array.from(p.childNodes).every(child => {
|
|
66
|
+
var _a;
|
|
67
|
+
return (child.nodeType === Node.ELEMENT_NODE &&
|
|
68
|
+
child.tagName.toLowerCase() === HTML_ELEMENTS.BR) ||
|
|
69
|
+
(child.nodeType === Node.TEXT_NODE && !((_a = child.textContent) === null || _a === void 0 ? void 0 : _a.trim()));
|
|
70
|
+
});
|
|
71
|
+
if (hasOnlyBrOrWhitespace && p.childNodes.length > 0) {
|
|
72
|
+
// Replace <p><br></p> with just <br>
|
|
73
|
+
const br = document.createElement(HTML_ELEMENTS.BR);
|
|
74
|
+
(_a = p.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(br, p);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
const mergeConsecutiveBreaks = (root) => {
|
|
79
|
+
const brs = root.querySelectorAll(HTML_ELEMENTS.BR);
|
|
80
|
+
brs.forEach(br => {
|
|
81
|
+
var _a, _b;
|
|
82
|
+
let next = br.nextSibling;
|
|
83
|
+
// Skip whitespace nodes
|
|
84
|
+
while (next &&
|
|
85
|
+
next.nodeType === Node.TEXT_NODE &&
|
|
86
|
+
!((_a = next.textContent) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
87
|
+
next = next.nextSibling;
|
|
88
|
+
}
|
|
89
|
+
// If next is also a br, remove this one
|
|
90
|
+
if (next &&
|
|
91
|
+
next.nodeType === Node.ELEMENT_NODE &&
|
|
92
|
+
next.tagName.toLowerCase() === HTML_ELEMENTS.BR) {
|
|
93
|
+
(_b = br.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(br);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
const dedent = (str) => {
|
|
98
|
+
const lines = str.split('\n');
|
|
99
|
+
const nonEmptyLines = lines.filter(line => line.trim());
|
|
100
|
+
const LEADING_WHITESPACE_REGEX = /^\s*/;
|
|
101
|
+
const minIndent = nonEmptyLines.reduce((min, line) => {
|
|
102
|
+
const indent = line.match(LEADING_WHITESPACE_REGEX)[0].length;
|
|
103
|
+
return Math.min(min, indent);
|
|
104
|
+
}, Infinity);
|
|
105
|
+
return lines
|
|
106
|
+
.map(line => (line.length >= minIndent ? line.slice(minIndent) : line))
|
|
107
|
+
.join('\n')
|
|
108
|
+
.trim();
|
|
109
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AnyExtension, Editor } from '@tiptap/core';
|
|
2
|
+
export declare const getExtensions: (placeholder?: string) => AnyExtension[];
|
|
3
|
+
/**
|
|
4
|
+
* Handles image file insertion logic for Drop and Paste events.
|
|
5
|
+
*/
|
|
6
|
+
export declare const handleImageFile: (editor: Editor, file: File, pos?: number) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Validates if the URI is allowed based on security rules.
|
|
9
|
+
*/
|
|
10
|
+
export declare const validateLink: (url: string, ctx: {
|
|
11
|
+
defaultProtocol: string;
|
|
12
|
+
protocols: (string | {
|
|
13
|
+
scheme: string;
|
|
14
|
+
})[];
|
|
15
|
+
defaultValidate: (href: string) => boolean;
|
|
16
|
+
}) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Validates if the URL should be auto-linked.
|
|
19
|
+
*/
|
|
20
|
+
export declare const validateAutoLink: (url: string) => boolean;
|
|
21
|
+
//# sourceMappingURL=tiptap-extensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tiptap-extensions.d.ts","sourceRoot":"","sources":["../../../../src/tiptap/utils/tiptap-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAwDzD,eAAO,MAAM,aAAa,GAAI,cAAc,MAAM,KAAG,YAAY,EAgGhE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,EAAE,MAAM,IAAI,EAAE,MAAM,MAAM,SAqBvE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,KAAK,MAAM,EACX,KAAK;IACH,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,CAAC,MAAM,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;IAC3C,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CAC5C,YAmCF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,YAW3C,CAAC"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import Blockquote from '@tiptap/extension-blockquote';
|
|
2
|
+
import Bold from '@tiptap/extension-bold';
|
|
3
|
+
import Code from '@tiptap/extension-code';
|
|
4
|
+
import CodeBlock from '@tiptap/extension-code-block';
|
|
5
|
+
import Document from '@tiptap/extension-document';
|
|
6
|
+
import FileHandler from '@tiptap/extension-file-handler';
|
|
7
|
+
import HardBreak from '@tiptap/extension-hard-break';
|
|
8
|
+
import Heading from '@tiptap/extension-heading';
|
|
9
|
+
import Highlight from '@tiptap/extension-highlight';
|
|
10
|
+
import History from '@tiptap/extension-history';
|
|
11
|
+
import HorizontalRule from '@tiptap/extension-horizontal-rule';
|
|
12
|
+
import Image from '@tiptap/extension-image';
|
|
13
|
+
import Italic from '@tiptap/extension-italic';
|
|
14
|
+
import Link from '@tiptap/extension-link';
|
|
15
|
+
import { BulletList, ListItem, OrderedList, TaskItem, TaskList } from '@tiptap/extension-list';
|
|
16
|
+
import Paragraph from '@tiptap/extension-paragraph';
|
|
17
|
+
import Placeholder from '@tiptap/extension-placeholder';
|
|
18
|
+
import Strike from '@tiptap/extension-strike';
|
|
19
|
+
import { Table, TableRow } from '@tiptap/extension-table';
|
|
20
|
+
import Text from '@tiptap/extension-text';
|
|
21
|
+
import TextAlign from '@tiptap/extension-text-align';
|
|
22
|
+
import { TextStyleKit } from '@tiptap/extension-text-style';
|
|
23
|
+
import Typography from '@tiptap/extension-typography';
|
|
24
|
+
import Underline from '@tiptap/extension-underline';
|
|
25
|
+
import Youtube from '@tiptap/extension-youtube';
|
|
26
|
+
import { Dropcursor, Gapcursor } from '@tiptap/extensions';
|
|
27
|
+
import { ALLOWED_IMAGE_MIMES, EXTENSION_PRIORITIES, HEADING_LEVELS, LINK_CONFIG, TEXT_ALIGN_TYPES } from '../constants/editor-config';
|
|
28
|
+
import { HTML_ELEMENTS } from '../constants/html-elements';
|
|
29
|
+
import { CommentExtension, CustomTableCell, CustomTableHeader, HtmlBlockExtension, HtmlInlineExtension, IframeExtension, ImageUploadExtension, ResetMarksOnEnter } from '../extensions';
|
|
30
|
+
import { SecureScriptExtension } from '../extensions/secure-script-extension';
|
|
31
|
+
const DROP_CURSOR_COLOR = '#fff';
|
|
32
|
+
export const getExtensions = (placeholder) => [
|
|
33
|
+
Document.extend({
|
|
34
|
+
content: '(block|horizontalRule)+'
|
|
35
|
+
}),
|
|
36
|
+
Text,
|
|
37
|
+
Paragraph.extend({
|
|
38
|
+
addAttributes() {
|
|
39
|
+
return {
|
|
40
|
+
style: { default: null },
|
|
41
|
+
class: { default: null },
|
|
42
|
+
id: { default: null }
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}),
|
|
46
|
+
HardBreak,
|
|
47
|
+
HorizontalRule.extend({
|
|
48
|
+
parseHTML() {
|
|
49
|
+
return [
|
|
50
|
+
{
|
|
51
|
+
tag: HTML_ELEMENTS.HR,
|
|
52
|
+
priority: EXTENSION_PRIORITIES.HORIZONTAL_RULE
|
|
53
|
+
}
|
|
54
|
+
];
|
|
55
|
+
},
|
|
56
|
+
addNodeView() {
|
|
57
|
+
return () => {
|
|
58
|
+
const hr = document.createElement(HTML_ELEMENTS.HR);
|
|
59
|
+
return { dom: hr };
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}),
|
|
63
|
+
Heading.configure({
|
|
64
|
+
levels: [...HEADING_LEVELS]
|
|
65
|
+
}),
|
|
66
|
+
Blockquote,
|
|
67
|
+
CodeBlock,
|
|
68
|
+
HtmlBlockExtension,
|
|
69
|
+
HtmlInlineExtension,
|
|
70
|
+
IframeExtension,
|
|
71
|
+
SecureScriptExtension,
|
|
72
|
+
CommentExtension,
|
|
73
|
+
TextStyleKit,
|
|
74
|
+
Bold,
|
|
75
|
+
Italic,
|
|
76
|
+
Underline,
|
|
77
|
+
Strike,
|
|
78
|
+
Code,
|
|
79
|
+
Highlight.configure({ multicolor: true }),
|
|
80
|
+
Typography,
|
|
81
|
+
TextAlign.configure({
|
|
82
|
+
types: [...TEXT_ALIGN_TYPES]
|
|
83
|
+
}),
|
|
84
|
+
BulletList,
|
|
85
|
+
OrderedList,
|
|
86
|
+
ListItem,
|
|
87
|
+
TaskList,
|
|
88
|
+
TaskItem.configure({
|
|
89
|
+
nested: true
|
|
90
|
+
}),
|
|
91
|
+
Image,
|
|
92
|
+
ImageUploadExtension,
|
|
93
|
+
FileHandler.configure({
|
|
94
|
+
allowedMimeTypes: ALLOWED_IMAGE_MIMES,
|
|
95
|
+
onDrop: (currentEditor, files, pos) => {
|
|
96
|
+
files.forEach(file => handleImageFile(currentEditor, file, pos));
|
|
97
|
+
},
|
|
98
|
+
onPaste: (currentEditor, files, htmlContent) => {
|
|
99
|
+
if (htmlContent)
|
|
100
|
+
return false;
|
|
101
|
+
files.forEach(file => handleImageFile(currentEditor, file));
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
Table.configure({ resizable: true }),
|
|
105
|
+
TableRow,
|
|
106
|
+
CustomTableHeader,
|
|
107
|
+
CustomTableCell,
|
|
108
|
+
Link.configure({
|
|
109
|
+
openOnClick: false,
|
|
110
|
+
autolink: true,
|
|
111
|
+
defaultProtocol: LINK_CONFIG.DEFAULT_PROTOCOL,
|
|
112
|
+
protocols: [...LINK_CONFIG.PROTOCOLS],
|
|
113
|
+
isAllowedUri: validateLink,
|
|
114
|
+
shouldAutoLink: validateAutoLink
|
|
115
|
+
}),
|
|
116
|
+
Gapcursor,
|
|
117
|
+
Dropcursor.configure({ color: DROP_CURSOR_COLOR }),
|
|
118
|
+
History,
|
|
119
|
+
ResetMarksOnEnter,
|
|
120
|
+
Youtube.configure({
|
|
121
|
+
controls: false,
|
|
122
|
+
nocookie: true,
|
|
123
|
+
allowFullscreen: false
|
|
124
|
+
}),
|
|
125
|
+
Placeholder.configure({
|
|
126
|
+
placeholder: placeholder || '',
|
|
127
|
+
emptyNodeClass: 'is-editor-empty'
|
|
128
|
+
})
|
|
129
|
+
];
|
|
130
|
+
/**
|
|
131
|
+
* Handles image file insertion logic for Drop and Paste events.
|
|
132
|
+
*/
|
|
133
|
+
export const handleImageFile = (editor, file, pos) => {
|
|
134
|
+
const fileReader = new FileReader();
|
|
135
|
+
fileReader.readAsDataURL(file);
|
|
136
|
+
fileReader.onload = () => {
|
|
137
|
+
const chain = editor.chain();
|
|
138
|
+
if (pos !== undefined) {
|
|
139
|
+
chain.insertContentAt(pos, {
|
|
140
|
+
type: 'image',
|
|
141
|
+
attrs: { src: fileReader.result }
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
chain.insertContentAt(editor.state.selection.anchor, {
|
|
146
|
+
type: 'image',
|
|
147
|
+
attrs: { src: fileReader.result }
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
chain.focus().run();
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Validates if the URI is allowed based on security rules.
|
|
155
|
+
*/
|
|
156
|
+
export const validateLink = (url, ctx) => {
|
|
157
|
+
if (!url)
|
|
158
|
+
return true;
|
|
159
|
+
try {
|
|
160
|
+
const parsedUrl = url.includes(':')
|
|
161
|
+
? new URL(url)
|
|
162
|
+
: new URL(`${ctx.defaultProtocol}://${url}`);
|
|
163
|
+
if (!ctx.defaultValidate(parsedUrl.href)) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
const protocol = parsedUrl.protocol.replace(':', '');
|
|
167
|
+
if (LINK_CONFIG.DISALLOWED_PROTOCOLS.includes(protocol)) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
const allowedProtocols = ctx.protocols.map(p => typeof p === 'string' ? p : p.scheme);
|
|
171
|
+
if (!allowedProtocols.includes(protocol)) {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
const domain = parsedUrl.hostname;
|
|
175
|
+
if (LINK_CONFIG.PHISHING_DOMAINS.includes(domain)) {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
catch (_a) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Validates if the URL should be auto-linked.
|
|
186
|
+
*/
|
|
187
|
+
export const validateAutoLink = (url) => {
|
|
188
|
+
try {
|
|
189
|
+
const parsedUrl = url.includes(':')
|
|
190
|
+
? new URL(url)
|
|
191
|
+
: new URL(`${LINK_CONFIG.DEFAULT_PROTOCOL}://${url}`);
|
|
192
|
+
const domain = parsedUrl.hostname;
|
|
193
|
+
return !LINK_CONFIG.NO_AUTOLINK_DOMAINS.includes(domain);
|
|
194
|
+
}
|
|
195
|
+
catch (_a) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/index.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
4
|
+
import { AkiTextEditor } from '../index';
|
|
5
|
+
vi.mock('../tiptap/components/tiptap', () => ({
|
|
6
|
+
Tiptap: (props) => (React.createElement("div", { "data-testid": "mock-tiptap" }, JSON.stringify(props)))
|
|
7
|
+
}));
|
|
8
|
+
describe('AkiTextEditor', () => {
|
|
9
|
+
it('should render Tiptap component and apply default class', () => {
|
|
10
|
+
render(React.createElement(AkiTextEditor, { value: "test content" }));
|
|
11
|
+
const wrapper = screen.getByTestId('mock-tiptap').parentElement;
|
|
12
|
+
expect(wrapper).toHaveClass('akinon-text-editor');
|
|
13
|
+
expect(screen.getByTestId('mock-tiptap')).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
it('should apply custom wrapper class from classNames prop', () => {
|
|
16
|
+
const classNames = {
|
|
17
|
+
editorWrapper: 'custom-wrapper-class'
|
|
18
|
+
};
|
|
19
|
+
render(React.createElement(AkiTextEditor, { classNames: classNames }));
|
|
20
|
+
const wrapper = screen.getByTestId('mock-tiptap').parentElement;
|
|
21
|
+
expect(wrapper).toHaveClass('akinon-text-editor');
|
|
22
|
+
expect(wrapper).toHaveClass('custom-wrapper-class');
|
|
23
|
+
});
|
|
24
|
+
it('should pass all props to Tiptap component', () => {
|
|
25
|
+
const props = {
|
|
26
|
+
value: '<p>Hello</p>',
|
|
27
|
+
readOnly: true,
|
|
28
|
+
locale: 'tr',
|
|
29
|
+
onChange: vi.fn()
|
|
30
|
+
};
|
|
31
|
+
render(React.createElement(AkiTextEditor, Object.assign({}, props)));
|
|
32
|
+
const tiptap = screen.getByTestId('mock-tiptap');
|
|
33
|
+
const passedProps = JSON.parse(tiptap.textContent || '{}');
|
|
34
|
+
expect(passedProps.value).toBe(props.value);
|
|
35
|
+
expect(passedProps.readOnly).toBe(props.readOnly);
|
|
36
|
+
expect(passedProps.locale).toBe(props.locale);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
4
|
+
|
|
5
|
+
import { AkiTextEditor } from '../index';
|
|
6
|
+
import { TextEditorProps } from '../tiptap/types';
|
|
7
|
+
|
|
8
|
+
vi.mock('../tiptap/components/tiptap', () => ({
|
|
9
|
+
Tiptap: (props: TextEditorProps) => (
|
|
10
|
+
<div data-testid="mock-tiptap">{JSON.stringify(props)}</div>
|
|
11
|
+
)
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
describe('AkiTextEditor', () => {
|
|
15
|
+
it('should render Tiptap component and apply default class', () => {
|
|
16
|
+
render(<AkiTextEditor value="test content" />);
|
|
17
|
+
|
|
18
|
+
const wrapper = screen.getByTestId('mock-tiptap').parentElement;
|
|
19
|
+
expect(wrapper).toHaveClass('akinon-text-editor');
|
|
20
|
+
expect(screen.getByTestId('mock-tiptap')).toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should apply custom wrapper class from classNames prop', () => {
|
|
24
|
+
const classNames = {
|
|
25
|
+
editorWrapper: 'custom-wrapper-class'
|
|
26
|
+
};
|
|
27
|
+
render(<AkiTextEditor classNames={classNames} />);
|
|
28
|
+
|
|
29
|
+
const wrapper = screen.getByTestId('mock-tiptap').parentElement;
|
|
30
|
+
expect(wrapper).toHaveClass('akinon-text-editor');
|
|
31
|
+
expect(wrapper).toHaveClass('custom-wrapper-class');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should pass all props to Tiptap component', () => {
|
|
35
|
+
const props = {
|
|
36
|
+
value: '<p>Hello</p>',
|
|
37
|
+
readOnly: true,
|
|
38
|
+
locale: 'tr' as const,
|
|
39
|
+
onChange: vi.fn()
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
render(<AkiTextEditor {...props} />);
|
|
43
|
+
|
|
44
|
+
const tiptap = screen.getByTestId('mock-tiptap');
|
|
45
|
+
const passedProps = JSON.parse(tiptap.textContent || '{}');
|
|
46
|
+
|
|
47
|
+
expect(passedProps.value).toBe(props.value);
|
|
48
|
+
expect(passedProps.readOnly).toBe(props.readOnly);
|
|
49
|
+
expect(passedProps.locale).toBe(props.locale);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAKtE,eAAO,MAAM,IAAI,EAAE,iBAOjB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
declare const translations: {
|
|
2
|
+
readonly editor: {
|
|
3
|
+
readonly common: {
|
|
4
|
+
readonly save: "Save";
|
|
5
|
+
readonly remove: "Remove";
|
|
6
|
+
readonly cancel: "Cancel";
|
|
7
|
+
readonly apply: "Apply";
|
|
8
|
+
};
|
|
9
|
+
readonly heading: {
|
|
10
|
+
readonly tooltip: "Heading";
|
|
11
|
+
readonly paragraph: "Paragraph";
|
|
12
|
+
readonly h1: "Heading 1";
|
|
13
|
+
readonly h2: "Heading 2";
|
|
14
|
+
readonly h3: "Heading 3";
|
|
15
|
+
readonly h4: "Heading 4";
|
|
16
|
+
};
|
|
17
|
+
readonly toolbar: {
|
|
18
|
+
readonly bold: "Bold";
|
|
19
|
+
readonly italic: "Italic";
|
|
20
|
+
readonly strike: "Strike";
|
|
21
|
+
readonly underline: "Underline";
|
|
22
|
+
readonly clear_formatting: "Clear Formatting";
|
|
23
|
+
readonly text_color: "Text Color";
|
|
24
|
+
readonly highlight_color: "Highlight Color";
|
|
25
|
+
readonly bullet_list: "Bullet List";
|
|
26
|
+
readonly ordered_list: "Ordered List";
|
|
27
|
+
readonly code: "Code";
|
|
28
|
+
readonly code_block: "Code Block";
|
|
29
|
+
readonly blockquote: "Blockquote";
|
|
30
|
+
readonly horizontal_rule: "Horizontal Rule";
|
|
31
|
+
readonly insert_image: "Insert Image";
|
|
32
|
+
readonly undo: "Undo";
|
|
33
|
+
readonly redo: "Redo";
|
|
34
|
+
readonly source_mode: "Switch to Source Mode";
|
|
35
|
+
readonly normal_mode: "Switch to Preview Mode";
|
|
36
|
+
readonly link: "Link";
|
|
37
|
+
readonly align_left: "Align Left";
|
|
38
|
+
readonly align_center: "Align Center";
|
|
39
|
+
readonly align_right: "Align Right";
|
|
40
|
+
readonly justify: "Justify";
|
|
41
|
+
};
|
|
42
|
+
readonly link: {
|
|
43
|
+
readonly tooltip: "Add Link";
|
|
44
|
+
readonly text_placeholder: "Link text";
|
|
45
|
+
readonly url_placeholder: "https://your-link.com";
|
|
46
|
+
};
|
|
47
|
+
readonly youtube: {
|
|
48
|
+
readonly tooltip: "Insert YouTube Video";
|
|
49
|
+
readonly placeholder: "Enter YouTube URL";
|
|
50
|
+
readonly cancel: "Cancel";
|
|
51
|
+
readonly insert: "Insert";
|
|
52
|
+
};
|
|
53
|
+
readonly color_picker: {
|
|
54
|
+
readonly recommended: "Recommended";
|
|
55
|
+
};
|
|
56
|
+
readonly table: {
|
|
57
|
+
readonly insert_table: "Insert Table";
|
|
58
|
+
readonly select_size: "Select table size";
|
|
59
|
+
readonly cell_properties: "Cell Properties";
|
|
60
|
+
readonly add_column_before: "Add Column Before";
|
|
61
|
+
readonly add_column_after: "Add Column After";
|
|
62
|
+
readonly delete_column: "Delete Column";
|
|
63
|
+
readonly add_row_before: "Add Row Before";
|
|
64
|
+
readonly add_row_after: "Add Row After";
|
|
65
|
+
readonly delete_row: "Delete Row";
|
|
66
|
+
readonly merge_cells: "Merge Cells";
|
|
67
|
+
readonly split_cell: "Split Cell";
|
|
68
|
+
readonly delete_table: "Delete Table";
|
|
69
|
+
readonly border: "Border";
|
|
70
|
+
readonly background: "Background";
|
|
71
|
+
readonly width: "Width";
|
|
72
|
+
readonly border_style: {
|
|
73
|
+
readonly solid: "Solid";
|
|
74
|
+
readonly dashed: "Dashed";
|
|
75
|
+
readonly dotted: "Dotted";
|
|
76
|
+
readonly double: "Double";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
readonly image_upload: {
|
|
80
|
+
readonly click_to_upload: "Click to upload or drag and drop";
|
|
81
|
+
readonly drag_and_drop_hint: "Maximum 3 files, 5MB each.";
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export default translations;
|
|
86
|
+
//# sourceMappingURL=en.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../src/i18n/translations/en.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmFR,CAAC;AAEX,eAAe,YAAY,CAAC"}
|