@designcrowd/library.brand-page 6.1.1-json-prereq-4 → 6.1.1
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/lib/src/{CreatedOnBrandCrowd-de-de-Dk-G3RbI.js → CreatedOnBrandCrowd-de-de-B5B5ThJ6.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-AVAWRjbj.js → CreatedOnBrandCrowd-en-us-a48CaORy.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-C5Xq4Jln.js → CreatedOnBrandCrowd-es-es-xpuZ317-.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-BQXjmcrr.js → CreatedOnBrandCrowd-fr-ca-V-iUMArW.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-BQXjmcrr.js → CreatedOnBrandCrowd-fr-fr-V-iUMArW.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-DRMRc1Zk.js → CreatedOnBrandCrowd-pt-br-DZ0NKSAy.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-DRMRc1Zk.js → CreatedOnBrandCrowd-pt-pt-DZ0NKSAy.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-Dd9-oQ34.js → CreatedOnDcom-de-de-_950cgGp.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-CnDfLzF4.js → CreatedOnDcom-en-us-DogKzH-g.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-bvqvI9gT.js → CreatedOnDcom-es-es-CmGM3IPX.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-BG7UGFe8.js → CreatedOnDcom-fr-ca-BonEDkWZ.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-xdz35O_B.js → CreatedOnDcom-fr-fr-DQHtKrd_.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-CLfHnCkk.js → CreatedOnDcom-pt-br-CtYJSBjs.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-Z7FY0BXt.js → CreatedOnDcom-pt-pt-DoO9r4lA.js} +1 -1
- package/lib/src/brand-page/components/contact-form/ContactForm.mixin.js +7 -8
- package/lib/src/brand-page/components/mailing-list/MailingList.mixin.js +6 -4
- package/lib/src/brand-page/components/page-footer/PageFooter.mixin.d.ts +1 -0
- package/lib/src/brand-page/components/page-footer/PageFooter.mixin.js +4 -1
- package/lib/src/brand-page/components/payment/Payment.mixin.js +4 -3
- package/lib/src/brand-page/components/payment/__fixtures__/request-payment.d.ts +1 -0
- package/lib/src/brand-page/components/payment/__fixtures__/support-me.d.ts +1 -0
- package/lib/src/brand-page/components/payment/request-payment/RequestPayment.mixin.d.ts +1 -0
- package/lib/src/brand-page/components/payment/request-payment/RequestPayment.mixin.js +4 -1
- package/lib/src/brand-page/composables/consent.composable.d.ts +2 -0
- package/lib/src/brand-page/composables/consent.composable.js +9 -3
- package/lib/src/brand-page/models/brand-page-context.model.d.ts +7 -0
- package/lib/src/brand-page/models/index.d.ts +26 -34
- package/lib/src/brand-page/utils/context.util.d.ts +8 -0
- package/lib/src/brand-page/utils/context.util.js +8 -0
- package/lib/src/brand-page/utils/migration.util.js +0 -11
- package/lib/src/brand-page/utils/text.util.d.ts +1 -13
- package/lib/src/brand-page/utils/text.util.js +0 -64
- package/lib/src/brand-page/utils/vcard.util.js +4 -4
- package/lib/src/brand-page/utils/view-model.util.d.ts +0 -1
- package/lib/src/brand-page/utils/view-model.util.js +20 -68
- package/lib/src/brand-page/view-models.d.ts +3 -3
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +1 -1
- package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.js +51 -18
- package/lib/src/brand-page-maker/composables/ai-chat/useAiMetadataBuilder.d.ts +1 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/bubbleMenu.d.ts +9 -2
- package/lib/src/brand-page-maker/composables/rich-text-editor/bubbleMenu.js +10 -6
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/FontSize.d.ts +20 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/FontSize.js +44 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/LineHeight.d.ts +27 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/LineHeight.js +44 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.d.ts +1 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +103 -24
- package/lib/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.js +8 -0
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +9 -3
- package/lib/src/brand-page-maker/stores/ui/ui-store.d.ts +1 -1
- package/lib/src/brand-page-maker/utils/index.d.ts +0 -2
- package/lib/src/brand-page-maker/utils/index.js +0 -2
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.d.ts +5 -36
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.js +5 -65
- package/lib/src/brand-page-maker/validators/field.validator.js +2 -10
- package/lib/src/clients/models.d.ts +2 -0
- package/lib/src/css/library.brand-page-brandCrowd.min.css +99 -102
- package/lib/src/css/library.brand-page-brandPage.min.css +99 -102
- package/lib/src/css/library.brand-page-designCom.min.css +99 -102
- package/lib/src/css/library.brand-page-preview.min.css +99 -102
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.mjs +219 -221
- package/lib/src/{lib-uYwxz8qR.js → lib-DtalJKI3.js} +71861 -75344
- package/lib/src/lib.js +1 -2
- package/lib/src/metadata-builder/ai-metadata-executor.d.ts +1 -0
- package/lib/src/metadata-builder/ai-metadata-executor.js +19 -0
- package/lib/src/metadata-builder/builders/section-builders/about-section-builder.js +3 -2
- package/lib/src/metadata-builder/builders/section-builders/banner-section-builder.js +3 -2
- package/lib/src/metadata-builder/builders/section-builders/booking-section-builder.js +3 -2
- package/lib/src/metadata-builder/builders/section-builders/contact-form-builder.js +4 -3
- package/lib/src/metadata-builder/builders/section-builders/images-section-builder.js +3 -2
- package/lib/src/metadata-builder/builders/section-builders/mailing-list-builder.js +2 -1
- package/lib/src/metadata-builder/builders/section-builders/mailing-list-section-builder.js +2 -1
- package/lib/src/metadata-builder/builders/section-builders/profile-section-builder.js +4 -3
- package/lib/src/metadata-builder/builders/section-builders/shapes-section-builder.js +3 -2
- package/lib/src/metadata-builder/builders/section-builders/testimonial-section-builder.js +2 -1
- package/lib/src/metadata-builder/builders/section-builders/text-section-builder.js +11 -15
- package/lib/src/metadata-builder/builders/update-content-text-builder.d.ts +17 -0
- package/lib/src/metadata-builder/builders/update-content-text-builder.js +103 -0
- package/lib/src/metadata-builder/builders/update-content-text-style-builder.d.ts +16 -0
- package/lib/src/metadata-builder/builders/update-content-text-style-builder.js +216 -0
- package/lib/src/metadata-builder/helpers/rte.helpers.d.ts +13 -11
- package/lib/src/metadata-builder/helpers/rte.helpers.js +73 -14
- package/lib/src/metadata-builder/metadata-executor.js +4 -0
- package/lib/src/metadata-builder/models.d.ts +2 -0
- package/lib/src/metadata-builder/models.js +2 -0
- package/lib/src/metadata-builder/parsers/ai-toolcall-parser.d.ts +19 -0
- package/lib/src/metadata-builder/parsers/ai-toolcall-parser.js +4 -0
- package/lib/src/metadata-builder/sanitizers/rte-schema-check.d.ts +8 -7
- package/lib/src/metadata-builder/sanitizers/rte-schema-check.js +52 -21
- package/lib/src/shared/content-settings/components/GenericTextInput.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/GenericTextInput.mixin.js +10 -35
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.js +3 -12
- package/lib/src/shared/content-settings/components/email-field/EmailField.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/tel-field/TelField.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/testimonial-items-field/TestimonialItemsField.mixin.d.ts +2 -3
- package/lib/src/shared/content-settings/components/testimonial-items-field/TestimonialItemsField.mixin.js +3 -10
- package/lib/src/shared/content-settings/components/text-field/TextField.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.d.ts +1 -2
- package/lib/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.js +1 -4
- package/lib/src/shared/content-settings/components/textarea-field/TextareaField.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/url-field/UrlField.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/youtube-video-field/YoutubeVideoField.mixin.d.ts +1 -1
- package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +1 -1
- package/lib/src/shared/logo-versions/LogoVersions.mixin.d.ts +1 -1
- package/lib/src/shared/my-designs/MyDesigns.mixin.d.ts +1 -1
- package/lib/src/shared/my-uploads/MyMedia.mixin.d.ts +1 -1
- package/lib/src/shared/my-uploads/MyUploads.mixin.d.ts +1 -1
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +1 -1
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +1 -1
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +1 -1
- package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.d.ts +1 -1
- package/lib/src/shared/template-settings/store/template-settings-store.d.ts +2 -0
- package/lib/src/shared/template-settings/store/template-settings-store.js +72 -24
- package/lib/src/shared/unsplash-library/UnsplashLibrary.mixin.d.ts +1 -1
- package/lib/src/utils/minify-brand-page-metadata.js +1 -4
- package/package.json +15 -17
- package/src/brand-page/components/contact-form/ContactForm.mixin.ts +9 -7
- package/src/brand-page/components/cookie-consent/CookieConsent.vue +1 -0
- package/src/brand-page/components/mailing-list/MailingList.mixin.ts +8 -3
- package/src/brand-page/components/navigation/navigation-carousel/NavigationCarousel.vue +5 -1
- package/src/brand-page/components/page-footer/PageFooter.mixin.ts +4 -1
- package/src/brand-page/components/page-footer/PageFooter.vue +1 -1
- package/src/brand-page/components/payment/Payment.mixin.ts +4 -3
- package/src/brand-page/components/payment/request-payment/RequestPayment.mixin.ts +8 -1
- package/src/brand-page/components/payment/request-payment/RequestPayment.vue +1 -1
- package/src/brand-page/components/save-contact/SaveContactWidget.vue +2 -1
- package/src/brand-page/components/shop/Shop.vue +6 -3
- package/src/brand-page/components/social-links/SocialLinks.vue +5 -2
- package/src/brand-page/components/text-wrapper/TextWrapper.vue +6 -17
- package/src/brand-page/composables/consent.composable.ts +18 -4
- package/src/brand-page/models/brand-page-context.model.ts +7 -0
- package/src/brand-page/models/index.ts +26 -35
- package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +3 -3
- package/src/brand-page/utils/context.util.test.ts +43 -0
- package/src/brand-page/utils/context.util.ts +10 -0
- package/src/brand-page/utils/migration.util.ts +0 -12
- package/src/brand-page/utils/style.util.test.ts +0 -51
- package/src/brand-page/utils/text.util.ts +4 -83
- package/src/brand-page/utils/vcard.util.ts +4 -6
- package/src/brand-page/utils/view-model.util.ts +26 -94
- package/src/brand-page/view-models.ts +2 -3
- package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.vue +4 -5
- package/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.test.ts +135 -0
- package/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.ts +62 -21
- package/src/brand-page-maker/composables/ai-chat/useAiMetadataBuilder.ts +1 -0
- package/src/brand-page-maker/composables/rich-text-editor/bubbleMenu.ts +10 -6
- package/src/brand-page-maker/composables/rich-text-editor/extensions/FontSize.ts +73 -0
- package/src/brand-page-maker/composables/rich-text-editor/extensions/LineHeight.ts +85 -0
- package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +111 -27
- package/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.ts +9 -0
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +11 -3
- package/src/brand-page-maker/stores/ui/ui-store.ts +1 -1
- package/src/brand-page-maker/utils/index.ts +0 -2
- package/src/brand-page-maker/utils/rich-text-editor.util.test.ts +3 -62
- package/src/brand-page-maker/utils/rich-text-editor.util.ts +11 -86
- package/src/brand-page-maker/validators/field.validator.ts +2 -10
- package/src/clients/models.ts +3 -0
- package/src/lib.ts +1 -9
- package/src/metadata-builder/ai-metadata-executor.ts +26 -0
- package/src/metadata-builder/builders/section-builders/about-section-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/banner-section-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/booking-section-builder.ts +5 -2
- package/src/metadata-builder/builders/section-builders/contact-form-builder.ts +4 -3
- package/src/metadata-builder/builders/section-builders/images-section-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/mailing-list-builder.ts +2 -1
- package/src/metadata-builder/builders/section-builders/mailing-list-section-builder.ts +2 -1
- package/src/metadata-builder/builders/section-builders/profile-section-builder.ts +6 -3
- package/src/metadata-builder/builders/section-builders/shapes-section-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/testimonial-section-builder.ts +2 -1
- package/src/metadata-builder/builders/section-builders/text-section-builder.ts +13 -19
- package/src/metadata-builder/builders/update-content-text-builder.ts +148 -0
- package/src/metadata-builder/builders/update-content-text-style-builder.ts +352 -0
- package/src/metadata-builder/helpers/rte.helpers.ts +101 -15
- package/src/metadata-builder/metadata-executor.ts +5 -0
- package/src/metadata-builder/models.ts +3 -0
- package/src/metadata-builder/parsers/ai-toolcall-parser.ts +27 -0
- package/src/metadata-builder/sanitizers/rte-schema-check.ts +53 -24
- package/src/shared/content-settings/components/GenericTextInput.mixin.ts +11 -42
- package/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.ts +3 -16
- package/src/shared/content-settings/components/testimonial-items-field/TestimonialItemsField.mixin.ts +4 -13
- package/src/shared/content-settings/components/testimonial-items-field/TestimonialItemsField.vue +4 -6
- package/src/shared/content-settings/components/text-image-field/TextImageField.vue +3 -6
- package/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.ts +1 -6
- package/src/shared/content-settings/components/text-items-field/TextItemsField.vue +1 -1
- package/src/shared/template-settings/store/template-settings-store.ts +93 -27
- package/src/utils/minify-brand-page-metadata.ts +1 -4
- package/lib/src/brand-page/utils/migration/migration-20.d.ts +0 -2
- package/lib/src/brand-page/utils/migration/migration-20.js +0 -66
- package/lib/src/brand-page-maker/__fixtures__/complex-rte.fixture.d.ts +0 -22
- package/lib/src/brand-page-maker/__fixtures__/complex-rte.fixture.js +0 -22
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/FontFamily.d.ts +0 -14
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/FontFamily.js +0 -39
- package/lib/src/brand-page-maker/composables/rich-text-editor/getRteExtensions.d.ts +0 -28
- package/lib/src/brand-page-maker/composables/rich-text-editor/getRteExtensions.js +0 -117
- package/lib/src/brand-page-maker/utils/rte-render.util.d.ts +0 -63
- package/lib/src/brand-page-maker/utils/rte-render.util.js +0 -95
- package/lib/src/brand-page-maker/utils/rte-sanitize.util.d.ts +0 -6
- package/lib/src/brand-page-maker/utils/rte-sanitize.util.js +0 -156
- package/src/brand-page/utils/migration/migration-20.server.test.ts +0 -125
- package/src/brand-page/utils/migration/migration-20.test.ts +0 -72
- package/src/brand-page/utils/migration/migration-20.ts +0 -87
- package/src/brand-page/utils/text.util.test.ts +0 -106
- package/src/brand-page/utils/view-model.pageid-rte.test.ts +0 -104
- package/src/brand-page-maker/__fixtures__/complex-rte.fixture.ts +0 -23
- package/src/brand-page-maker/composables/rich-text-editor/extensions/FontFamily.test.ts +0 -52
- package/src/brand-page-maker/composables/rich-text-editor/extensions/FontFamily.ts +0 -42
- package/src/brand-page-maker/composables/rich-text-editor/getRteExtensions.ts +0 -162
- package/src/brand-page-maker/utils/__snapshots__/rte-render-parity.test.ts.snap +0 -202
- package/src/brand-page-maker/utils/rte-features.test.ts +0 -378
- package/src/brand-page-maker/utils/rte-render-parity.test.ts +0 -164
- package/src/brand-page-maker/utils/rte-render.util.ts +0 -165
- package/src/brand-page-maker/utils/rte-sanitize-json.test.ts +0 -172
- package/src/brand-page-maker/utils/rte-sanitize.util.ts +0 -192
- package/src/brand-page-maker/validators/field.validator.test.ts +0 -55
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import type { Extensions } from '@tiptap/vue-3';
|
|
2
|
-
import StarterKit from '@tiptap/starter-kit';
|
|
3
|
-
import Underline from '@tiptap/extension-underline';
|
|
4
|
-
import { TextStyle, FontSize, LineHeight } from '@tiptap/extension-text-style';
|
|
5
|
-
import TextAlign from '@tiptap/extension-text-align';
|
|
6
|
-
import ColorExtension from '@tiptap/extension-color';
|
|
7
|
-
import Highlight from '@tiptap/extension-highlight';
|
|
8
|
-
import Placeholder from '@tiptap/extension-placeholder';
|
|
9
|
-
import Link from '@tiptap/extension-link';
|
|
10
|
-
import { FontFamily } from './extensions/FontFamily';
|
|
11
|
-
import { LetterSpacing } from './extensions/LetterSpacing';
|
|
12
|
-
import { MaxLength } from './extensions/MaxLength';
|
|
13
|
-
import { AutoLink } from './extensions/AutoLink';
|
|
14
|
-
import { isHrefPageId } from './hyperlink';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Single source of truth for the Tiptap extension set (BP-5787).
|
|
18
|
-
*
|
|
19
|
-
* The live editor, the headless serialiser (useExternalRichTextEditor), and
|
|
20
|
-
* the upcoming render-from-JSON path must all use the SAME extensions, or
|
|
21
|
-
* rendered output drifts from what the user authored. This factory removes the
|
|
22
|
-
* previous duplication while preserving each consumer's exact configuration.
|
|
23
|
-
*
|
|
24
|
-
* Known, intentional differences are parameterised:
|
|
25
|
-
* - `restrictStarterKit` — the live editor disables list/hr/code nodes.
|
|
26
|
-
* - `editing` — only the live editor carries the Placeholder + MaxLength plugins
|
|
27
|
-
* (neither affects serialised output; they are editing-time only).
|
|
28
|
-
*
|
|
29
|
-
* Link target/rel are NOT parameterised: they are a pure function of the href
|
|
30
|
-
* applied in the Link mark's renderHTML (below), so every consumer — live
|
|
31
|
-
* editor, static renderer, schema check — emits identical link markup.
|
|
32
|
-
*/
|
|
33
|
-
export interface RteExtensionOptions {
|
|
34
|
-
/** Disable StarterKit nodes the editor doesn't use (lists, hr, code). */
|
|
35
|
-
restrictStarterKit?: boolean;
|
|
36
|
-
/** When present, add the live-editing-only plugins (Placeholder, MaxLength). */
|
|
37
|
-
editing?: {
|
|
38
|
-
placeholder?: string;
|
|
39
|
-
maxLength?: number;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export const getRteExtensions = (
|
|
44
|
-
options: RteExtensionOptions = {},
|
|
45
|
-
): Extensions => {
|
|
46
|
-
const { restrictStarterKit = false, editing } = options;
|
|
47
|
-
|
|
48
|
-
const extensions: Extensions = [
|
|
49
|
-
// v3 StarterKit bundles Link + Underline; we register both separately (with
|
|
50
|
-
// custom Link config), so disable the bundled copies to avoid duplicate
|
|
51
|
-
// extension errors.
|
|
52
|
-
// trailingNode: false — v3 StarterKit adds a TrailingNode plugin (not in v2)
|
|
53
|
-
// that appends an empty paragraph after any non-paragraph trailing block.
|
|
54
|
-
// Disabled to keep editor/stored-content behaviour identical to v2 (BP-5787
|
|
55
|
-
// is backward-compat-first); revisit as a standalone UX change if wanted.
|
|
56
|
-
restrictStarterKit
|
|
57
|
-
? StarterKit.configure({
|
|
58
|
-
link: false,
|
|
59
|
-
underline: false,
|
|
60
|
-
trailingNode: false,
|
|
61
|
-
bulletList: false,
|
|
62
|
-
orderedList: false,
|
|
63
|
-
listItem: false,
|
|
64
|
-
horizontalRule: false,
|
|
65
|
-
codeBlock: false,
|
|
66
|
-
code: false,
|
|
67
|
-
})
|
|
68
|
-
: StarterKit.configure({
|
|
69
|
-
link: false,
|
|
70
|
-
underline: false,
|
|
71
|
-
trailingNode: false,
|
|
72
|
-
}),
|
|
73
|
-
Underline,
|
|
74
|
-
// priority: 99 — render the textStyle <span> (which carries font-size) as the
|
|
75
|
-
// OUTERMOST inline mark, so decoration marks (<u>/<s>) nest INSIDE it and
|
|
76
|
-
// inherit the applied font-size. v3's extension-text-style defaults to
|
|
77
|
-
// priority 101, which flips this: <u>/<s> end up outside the font-size span
|
|
78
|
-
// and inherit only the base paragraph size. Since text-decoration thickness
|
|
79
|
-
// AND vertical position are computed from the decorating element's own font,
|
|
80
|
-
// that produced thin, mis-centred underline/strike on large text — a
|
|
81
|
-
// regression vs v2's serializer, which emitted the font-size span outermost
|
|
82
|
-
// (BP-5787, backward-compat-first).
|
|
83
|
-
TextStyle.extend({ priority: 99 }).configure({
|
|
84
|
-
mergeNestedSpanStyles: true,
|
|
85
|
-
}),
|
|
86
|
-
TextAlign.configure({
|
|
87
|
-
types: ['heading', 'paragraph'],
|
|
88
|
-
}),
|
|
89
|
-
FontFamily.configure({
|
|
90
|
-
types: ['textStyle'],
|
|
91
|
-
}),
|
|
92
|
-
// FontSize + LineHeight are now shipped natively by @tiptap/extension-text-style.
|
|
93
|
-
FontSize.configure({ types: ['textStyle'] }),
|
|
94
|
-
LetterSpacing,
|
|
95
|
-
LineHeight.configure({ types: ['textStyle'] }),
|
|
96
|
-
ColorExtension.configure({
|
|
97
|
-
types: ['textStyle'],
|
|
98
|
-
}),
|
|
99
|
-
Highlight.configure({
|
|
100
|
-
multicolor: true,
|
|
101
|
-
}),
|
|
102
|
-
];
|
|
103
|
-
|
|
104
|
-
// Live-editing-only plugins sit between Highlight and Link (original order).
|
|
105
|
-
if (editing) {
|
|
106
|
-
extensions.push(
|
|
107
|
-
Placeholder.configure({ placeholder: editing.placeholder }),
|
|
108
|
-
MaxLength.configure({ maxLength: editing.maxLength }),
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
extensions.push(
|
|
113
|
-
Link.extend({
|
|
114
|
-
// External-link policy lives at the serialisation boundary: target/rel are
|
|
115
|
-
// a pure function of the href, applied whenever a link mark renders to <a>
|
|
116
|
-
// (live editor DOM + static renderer alike). They are neither stored on the
|
|
117
|
-
// mark nor the sanitiser's concern — the sanitiser validates href only
|
|
118
|
-
// (see rte-sanitize.util.ts). This is what the old, unsupported
|
|
119
|
-
// `HTMLAttributes: (attrs) => …` function was trying (and failing) to do:
|
|
120
|
-
// Tiptap types HTMLAttributes as a static object, so a function silently
|
|
121
|
-
// no-ops, which is why fresh links lost target/rel after the JSON migration.
|
|
122
|
-
renderHTML(props) {
|
|
123
|
-
const href = props.HTMLAttributes.href;
|
|
124
|
-
const isExternal =
|
|
125
|
-
typeof href === 'string' &&
|
|
126
|
-
(href.startsWith('http://') || href.startsWith('https://'));
|
|
127
|
-
const HTMLAttributes = {
|
|
128
|
-
...props.HTMLAttributes,
|
|
129
|
-
target: isExternal ? '_blank' : null,
|
|
130
|
-
rel: isExternal ? 'noopener noreferrer' : null,
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
// Delegate to the base renderHTML so its XSS href-strip guard still runs.
|
|
134
|
-
// base Link always defines renderHTML, so the ?? branch is a defensive
|
|
135
|
-
// fallback only (never taken in practice); href is pre-validated by the
|
|
136
|
-
// sanitiser and isAllowedUri regardless.
|
|
137
|
-
return (
|
|
138
|
-
this.parent?.({ ...props, HTMLAttributes }) ?? [
|
|
139
|
-
'a',
|
|
140
|
-
HTMLAttributes,
|
|
141
|
-
0,
|
|
142
|
-
]
|
|
143
|
-
);
|
|
144
|
-
},
|
|
145
|
-
}).configure({
|
|
146
|
-
openOnClick: false,
|
|
147
|
-
defaultProtocol: 'https',
|
|
148
|
-
autolink: true,
|
|
149
|
-
// Override Tiptap's built-in Link defaults ({ target: '_blank', rel:
|
|
150
|
-
// 'noopener noreferrer nofollow' }) with nulls: target/rel are NOT stored on
|
|
151
|
-
// the mark, they are derived from the href at render time (see renderHTML
|
|
152
|
-
// above). configure() deep-merges HTMLAttributes, so an empty {} would leave
|
|
153
|
-
// those built-in defaults in place and stamp them onto every link — hence
|
|
154
|
-
// the explicit nulls.
|
|
155
|
-
HTMLAttributes: { target: null, rel: null },
|
|
156
|
-
isAllowedUri: (url, ctx) => ctx.defaultValidate(url) || isHrefPageId(url),
|
|
157
|
-
}),
|
|
158
|
-
AutoLink,
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
return extensions;
|
|
162
|
-
};
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
-
|
|
3
|
-
exports[`BP-5787 RTE render parity (golden master) > T1 — editor renders the complex fixture to the frozen HTML baseline > editor-normalized-html 1`] = `"<h2 style="text-align: center;"><span style="color: var(--logo-text-color);">Themed heading</span></h2><p><strong>bold</strong> <em>italic</em> <u>underline</u> <s>strike</s> <span style="font-family: Montserrat; font-size: 1.5em; letter-spacing: 0.05em; line-height: 1.4;">styled span</span> <mark data-color="#ffe08a" style="background-color: rgb(255, 224, 138); color: inherit;">highlight</mark> <span style="color: rgb(255, 0, 0);">literal hex</span> <a href="/about">internal link</a> <a target="_blank" rel="noopener noreferrer" href="https://example.com">external link</a></p><p style="text-align: right;">second paragraph, right-aligned</p>"`;
|
|
4
|
-
|
|
5
|
-
exports[`BP-5787 RTE render parity (golden master) > T1 — render-from-JSON (DOM-less renderer) produces equivalent HTML > serializer-html 1`] = `"<h2 style="text-align: center"><span style="color: var(--logo-text-color)">Themed heading</span></h2><p><strong>bold</strong> <em>italic</em> <u>underline</u> <s>strike</s> <span style="font-family: Montserrat; font-size: 1.5em; letter-spacing: 0.05em; line-height: 1.4">styled span</span> <mark data-color="#ffe08a" style="background-color: #ffe08a; color: inherit">highlight</mark> <span style="color: #FF0000">literal hex</span> <a href="/about">internal link</a> <a target="_blank" rel="noopener noreferrer" href="https://example.com">external link</a></p><p style="text-align: right">second paragraph, right-aligned</p>"`;
|
|
6
|
-
|
|
7
|
-
exports[`BP-5787 RTE render parity (golden master) > T6 — freezes the RAW editor JSON (pre-sanitise; not the persisted form) > editor-json 1`] = `
|
|
8
|
-
{
|
|
9
|
-
"content": [
|
|
10
|
-
{
|
|
11
|
-
"attrs": {
|
|
12
|
-
"level": 2,
|
|
13
|
-
"textAlign": "center",
|
|
14
|
-
},
|
|
15
|
-
"content": [
|
|
16
|
-
{
|
|
17
|
-
"marks": [
|
|
18
|
-
{
|
|
19
|
-
"attrs": {
|
|
20
|
-
"color": "var(--logo-text-color)",
|
|
21
|
-
"fontFamily": "",
|
|
22
|
-
"fontSize": "",
|
|
23
|
-
"letterSpacing": "",
|
|
24
|
-
"lineHeight": "",
|
|
25
|
-
},
|
|
26
|
-
"type": "textStyle",
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
"text": "Themed heading",
|
|
30
|
-
"type": "text",
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
"type": "heading",
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"attrs": {
|
|
37
|
-
"textAlign": null,
|
|
38
|
-
},
|
|
39
|
-
"content": [
|
|
40
|
-
{
|
|
41
|
-
"marks": [
|
|
42
|
-
{
|
|
43
|
-
"type": "bold",
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
"text": "bold",
|
|
47
|
-
"type": "text",
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"text": " ",
|
|
51
|
-
"type": "text",
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"marks": [
|
|
55
|
-
{
|
|
56
|
-
"type": "italic",
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
"text": "italic",
|
|
60
|
-
"type": "text",
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"text": " ",
|
|
64
|
-
"type": "text",
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"marks": [
|
|
68
|
-
{
|
|
69
|
-
"type": "underline",
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
"text": "underline",
|
|
73
|
-
"type": "text",
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"text": " ",
|
|
77
|
-
"type": "text",
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"marks": [
|
|
81
|
-
{
|
|
82
|
-
"type": "strike",
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
"text": "strike",
|
|
86
|
-
"type": "text",
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
"text": " ",
|
|
90
|
-
"type": "text",
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
"marks": [
|
|
94
|
-
{
|
|
95
|
-
"attrs": {
|
|
96
|
-
"color": "",
|
|
97
|
-
"fontFamily": "Montserrat",
|
|
98
|
-
"fontSize": "1.5em",
|
|
99
|
-
"letterSpacing": "0.05em",
|
|
100
|
-
"lineHeight": "1.4",
|
|
101
|
-
},
|
|
102
|
-
"type": "textStyle",
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
"text": "styled span",
|
|
106
|
-
"type": "text",
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"text": " ",
|
|
110
|
-
"type": "text",
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
"marks": [
|
|
114
|
-
{
|
|
115
|
-
"attrs": {
|
|
116
|
-
"color": "#ffe08a",
|
|
117
|
-
},
|
|
118
|
-
"type": "highlight",
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
"text": "highlight",
|
|
122
|
-
"type": "text",
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
"text": " ",
|
|
126
|
-
"type": "text",
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
"marks": [
|
|
130
|
-
{
|
|
131
|
-
"attrs": {
|
|
132
|
-
"color": "#FF0000",
|
|
133
|
-
"fontFamily": "",
|
|
134
|
-
"fontSize": "",
|
|
135
|
-
"letterSpacing": "",
|
|
136
|
-
"lineHeight": "",
|
|
137
|
-
},
|
|
138
|
-
"type": "textStyle",
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
"text": "literal hex",
|
|
142
|
-
"type": "text",
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
"text": " ",
|
|
146
|
-
"type": "text",
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
"marks": [
|
|
150
|
-
{
|
|
151
|
-
"attrs": {
|
|
152
|
-
"class": null,
|
|
153
|
-
"href": "/about",
|
|
154
|
-
"rel": null,
|
|
155
|
-
"target": "_self",
|
|
156
|
-
"title": null,
|
|
157
|
-
},
|
|
158
|
-
"type": "link",
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
"text": "internal link",
|
|
162
|
-
"type": "text",
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
"text": " ",
|
|
166
|
-
"type": "text",
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
"marks": [
|
|
170
|
-
{
|
|
171
|
-
"attrs": {
|
|
172
|
-
"class": null,
|
|
173
|
-
"href": "https://example.com",
|
|
174
|
-
"rel": "noopener noreferrer nofollow",
|
|
175
|
-
"target": "_blank",
|
|
176
|
-
"title": null,
|
|
177
|
-
},
|
|
178
|
-
"type": "link",
|
|
179
|
-
},
|
|
180
|
-
],
|
|
181
|
-
"text": "external link",
|
|
182
|
-
"type": "text",
|
|
183
|
-
},
|
|
184
|
-
],
|
|
185
|
-
"type": "paragraph",
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
"attrs": {
|
|
189
|
-
"textAlign": "right",
|
|
190
|
-
},
|
|
191
|
-
"content": [
|
|
192
|
-
{
|
|
193
|
-
"text": "second paragraph, right-aligned",
|
|
194
|
-
"type": "text",
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
"type": "paragraph",
|
|
198
|
-
},
|
|
199
|
-
],
|
|
200
|
-
"type": "doc",
|
|
201
|
-
}
|
|
202
|
-
`;
|