@wix/ricos-editor-elements 11.20.6 → 11.21.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.
@@ -27,9 +27,9 @@ import "@wix/ricos/css/plugin-video-viewer.global.css";
27
27
  import "@wix/ricos/css/plugin-audio-viewer.global.css";
28
28
  import "@wix/ricos/css/plugin-toc-viewer.global.css";
29
29
  import React, { useState } from "react";
30
- import { CSS_PROPERTIES, DISPLAY_GROUPS, ELEMENTS, DATA } from "@wix/react-component-schema";
30
+ import { CSS_PROPERTIES, DISPLAY_GROUPS, ELEMENTS, DATA, ACTIONS, LAYOUT } from "@wix/react-component-schema";
31
31
  import './Viewer.css';const customPropKey = (tag, cssVar) => `editor-ricos-${tag}-${cssVar}`;
32
- const CONTENT_VIEWER_SELECTOR = '[data-id="content-viewer"]';
32
+ const elementClassName = (tag) => `editor-ricos-${tag}`;
33
33
  const TEXT_LEVELS = [
34
34
  { tag: "h1", displayName: "Heading 1", siteFont: "--wst-heading-1-font" },
35
35
  { tag: "h2", displayName: "Heading 2", siteFont: "--wst-heading-2-font" },
@@ -83,14 +83,14 @@ const fontTextGroup = (tag, displayName) => ({
83
83
  const fontElement = (tag, displayName) => ({
84
84
  elementType: ELEMENTS.ELEMENT_TYPE.inlineElement,
85
85
  inlineElement: {
86
- selector: CONTENT_VIEWER_SELECTOR,
86
+ selector: `.${elementClassName(tag)}`,
87
87
  displayName,
88
88
  behaviors: { selectable: false },
89
89
  cssCustomProperties: fontCssCustomProperties(tag),
90
90
  displayGroups: { [tag]: fontTextGroup(tag, displayName) }
91
91
  }
92
92
  });
93
- Object.fromEntries(
93
+ const textElements = Object.fromEntries(
94
94
  TEXT_LEVELS.map(({ tag, displayName }) => [tag, fontElement(tag, displayName)])
95
95
  );
96
96
  ({
@@ -313,13 +313,16 @@ const buttonDisplayGroups = () => ({
313
313
  cssCustomProperties: buttonColorGroup("hover")
314
314
  }
315
315
  });
316
- ({
316
+ const buttonElement = {
317
317
  elementType: ELEMENTS.ELEMENT_TYPE.inlineElement,
318
318
  inlineElement: {
319
+ selector: `.${elementClassName(BUTTON_TAG)}`,
320
+ displayName: "Button",
321
+ behaviors: { selectable: false },
319
322
  cssCustomProperties: buttonCssCustomProperties(),
320
323
  displayGroups: buttonDisplayGroups()
321
324
  }
322
- });
325
+ };
323
326
  const viewerButtonStyle = Object.fromEntries(
324
327
  BUTTON_PROPS.map(({ varKey, themeField, defaultValue }) => [
325
328
  themeField,
@@ -356,12 +359,15 @@ const imageCssCustomProperties = () => Object.fromEntries(
356
359
  { cssPropertyType: type, displayName, ...defaultValue ? { defaultValue } : {} }
357
360
  ])
358
361
  );
359
- ({
362
+ const imageElement = {
360
363
  elementType: ELEMENTS.ELEMENT_TYPE.inlineElement,
361
364
  inlineElement: {
365
+ selector: `.${elementClassName(IMAGE_TAG)}`,
366
+ displayName: "Image",
367
+ behaviors: { selectable: false },
362
368
  cssCustomProperties: imageCssCustomProperties()
363
369
  }
364
- });
370
+ };
365
371
  const viewerImageStyle = Object.fromEntries(
366
372
  IMAGE_PROPS.map(({ varKey, themeField, defaultValue }) => [
367
373
  themeField,
@@ -444,7 +450,7 @@ Object.fromEntries(
444
450
  }
445
451
  ])
446
452
  );
447
- Object.fromEntries(
453
+ const paletteDisplayGroups = Object.fromEntries(
448
454
  PALETTE_SECTIONS.map(({ key, displayName }) => [
449
455
  key,
450
456
  {
@@ -507,6 +513,56 @@ const root = "root__bW8lC";
507
513
  const s = {
508
514
  root
509
515
  };
516
+ const editorElement = {
517
+ layout: {
518
+ resizeDirection: LAYOUT.RESIZE_DIRECTION.horizontal,
519
+ contentResizeDirection: LAYOUT.CONTENT_RESIZE_DIRECTION.vertical
520
+ },
521
+ // Per-level typography (one element per h1–h6 / paragraph) plus dedicated
522
+ // Button and Image elements, so each gets its own labeled panel section.
523
+ elements: { ...textElements, button: buttonElement, image: imageElement },
524
+ displayGroups: {
525
+ // Palette sub-sections (Base / Shades / Accent).
526
+ ...paletteDisplayGroups,
527
+ // Settings-panel sections: group the data items so Button and Content
528
+ // trimming controls sit under their own labeled sections instead of one list.
529
+ buttonSettings: {
530
+ groupType: DISPLAY_GROUPS.GROUP_TYPE.data
531
+ },
532
+ contentTrimming: {
533
+ groupType: DISPLAY_GROUPS.GROUP_TYPE.data
534
+ }
535
+ },
536
+ data: {
537
+ content: {
538
+ dataType: DATA.DATA_TYPE.ricosDocument
539
+ }
540
+ },
541
+ customActions: {
542
+ // Action-bar entry for `content`: a `data` action opens an auto panel with just this item,
543
+ // which in a CMS context renders the ricosDocument binding control (connect, or the bound
544
+ // field with disconnect). The label stays state-neutral, like native "Edit Text", because
545
+ // manifest runtime overrides can't change it once content is bound.
546
+ editContent: {
547
+ execution: {
548
+ actionType: ACTIONS.ACTION_TYPE.data
549
+ }
550
+ }
551
+ }
552
+ };
553
+ ({
554
+ installation: {
555
+ initialSize: {
556
+ width: {
557
+ sizingType: LAYOUT.SIZING_TYPE.pixels
558
+ },
559
+ height: {
560
+ sizingType: LAYOUT.SIZING_TYPE.content
561
+ }
562
+ }
563
+ }
564
+ });
565
+ const elementClassNames = Object.keys(editorElement.elements ?? {}).map(elementClassName).join(" ");
510
566
  const ViewerContent = ({
511
567
  id,
512
568
  content,
@@ -527,7 +583,7 @@ const ViewerContent = ({
527
583
  const { language } = useService(LocaleDefinition);
528
584
  const { siteId: metaSiteId } = useService(SiteInfoDefinition);
529
585
  const { siteUrl } = useService(UrlDefinition);
530
- return /* @__PURE__ */ React.createElement("div", { className: `${s.root} ${className}`, id }, /* @__PURE__ */ React.createElement(
586
+ return /* @__PURE__ */ React.createElement("div", { className: `${s.root} ${className}`, id }, /* @__PURE__ */ React.createElement("div", { className: elementClassNames }, /* @__PURE__ */ React.createElement(
531
587
  ContentTrimmer,
532
588
  {
533
589
  content,
@@ -590,7 +646,7 @@ const ViewerContent = ({
590
646
  ]
591
647
  }
592
648
  )
593
- ));
649
+ )));
594
650
  };
595
651
  const Viewer = ({ content, ...props }) => isContentProvided(content) ? /* @__PURE__ */ React.createElement(ViewerContent, { ...props, content }) : (
596
652
  // Keep the root so the platform still finds the component node.
@@ -11,8 +11,8 @@ export declare const buttonSizeData: NonNullable<EditorElement['data']>;
11
11
  /**
12
12
  * Dedicated (non-selectable) "Button" element so the global button controls get
13
13
  * their own labeled panel section instead of sitting on the root Viewer element.
14
- * Shares the content selector so its vars cascade to the rendered buttons, which
15
- * read them via `theme.customStyles.button`.
14
+ * Its selector names the content wrapper, so its vars cascade to the rendered
15
+ * buttons, which read them via `theme.customStyles.button`.
16
16
  */
17
17
  export declare const buttonElement: ElementItem;
18
18
  /**
@@ -5,7 +5,10 @@
5
5
  * the viewer reads `--<key>` back via `theme.customStyles` / `theme.colorPalette`. */
6
6
  export declare const customPropKey: (tag: string, cssVar: string) => string;
7
7
  /**
8
- * The ricos content wrapper. Inner elements scope their custom properties to it
9
- * so they cascade to the rendered content.
8
+ * `editor-ricos-<tag>` — the class an inner element's selector names. `viewer.tsx`
9
+ * puts every element's class on the wrapper around the ricos content, so each
10
+ * element's custom properties cascade to it. Each element needs its own class:
11
+ * Origami export maps a CSS rule back to an element by its selector, and only
12
+ * reads class selectors.
10
13
  */
11
- export declare const CONTENT_VIEWER_SELECTOR = "[data-id=\"content-viewer\"]";
14
+ export declare const elementClassName: (tag: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ricos-editor-elements",
3
- "version": "11.20.6",
3
+ "version": "11.21.1",
4
4
  "files": [
5
5
  "dist/lib/**"
6
6
  ],
@@ -43,7 +43,7 @@
43
43
  "@wix/essentials": "^1.0.15",
44
44
  "@wix/fed-cli-i18next": "^1.7.0",
45
45
  "@wix/react-component-schema": "^1.10.0",
46
- "@wix/ricos": "11.20.6",
46
+ "@wix/ricos": "11.21.1",
47
47
  "@wix/services-manager": "^1.0.7",
48
48
  "@wix/services-manager-react": "^1.0.8",
49
49
  "@wix/site-service-device-info": "^1.0.8",
@@ -107,5 +107,5 @@
107
107
  ]
108
108
  }
109
109
  },
110
- "falconPackageHash": "61c109bc8ddf1a68c4334296701abcd85af869168f0197287d44cb65"
110
+ "falconPackageHash": "312c3913493fb042381c94d17e6ba62564d9530b5c3535015b20458c"
111
111
  }