@innovastudio/contentbuilder 1.5.228 → 1.5.230

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/index.d.ts CHANGED
@@ -509,7 +509,7 @@ interface ContentBuilderAddonApi {
509
509
  /** Be the editor's icon picker: the editor's own add-an-icon buttons (text toolbar, ContentBox's Text panel) are hidden, Icon leaves content.blocks(), and every other way to an icon calls fn instead of the built-in icon window: { icon } to change a clicked icon (a font icon <i> or an add-on's <svg>), { place } for the quick add panel's Icon (place(html) puts html on a new line there), else { range } (the caret, or null). Returns a function that gives the editor its own picker back. */
510
510
  iconPicker(fn: (target: { icon: Element | null; place: ((html: string) => void) | null; range: Range | null }) => void): () => void;
511
511
  /** The editor's colour picker; onPick runs on every change ('' = no colour). */
512
- pickColor(opts: { color?: string; onPick?: (color: string) => void; onClose?: () => void }): boolean;
512
+ pickColor(opts: { color?: string; onPick?: (color: string) => void; onClose?: () => void; anchor?: HTMLElement }): boolean;
513
513
  /** Quiet editing: true hides the tools always shown in the page (row, column, element and
514
514
  * section tools, and the outlines), so the page is seen as it is published; a clicked
515
515
  * object (image, link, spacer, table, plugin, video) still gets its own tool. With
@@ -522,9 +522,16 @@ interface ContentBuilderAddonApi {
522
522
  /** Whether quiet editing is on in this editor. */
523
523
  isQuiet(): boolean;
524
524
  /** The editor's own icon, as markup, so an add-on's buttons look like the editor's:
525
- * 'bold', 'italic', 'underline', 'strikethrough', 'clean', 'link', 'unlink', 'up',
526
- * 'down', 'duplicate', 'delete', 'settings'. '' for another name. */
525
+ * 'bold', 'italic', 'underline', 'strikethrough', 'clean', 'link', 'unlink', 'code', 'up',
526
+ * 'down', 'duplicate', 'delete', 'settings', 'align-left', 'align-center', 'align-right',
527
+ * 'align-justify'. '' for another name. */
527
528
  icon(name: string): string;
529
+ /** Add an action for selected text, for an add-on that shows a panel beside a selection
530
+ * (Slash Commands) to offer. run() is called with the selection back in place. Returns a
531
+ * function that removes it; removed with the add-on too. */
532
+ addSelectionAction(def: { id: string; group?: string; title: string; html?: string; run: () => void }): () => void;
533
+ /** The actions add-ons gave for selected text, in the order added. */
534
+ selectionActions(): { id: string; addon: string; group: string; title: string; html: string; run: () => void }[];
528
535
  /** Hide the element tool (add, more, delete, settings beside a clicked element), for an
529
536
  * add-on that offers the same another way; as the Preferences' "hide element tool".
530
537
  * Returns a function that shows it again; also shown again when the add-on is removed. */
@@ -601,13 +608,24 @@ interface ContentBuilderAddonApi {
601
608
  blocks(): string[];
602
609
  /** Insert what the quick add panel's item inserts, right after `after` (an element in a
603
610
  * column), as one undo step. Returns the new elements in order; empty for 'more', which
604
- * opens the snippets window. */
605
- addBlock(id: string, after?: Element): HTMLElement[];
611
+ * opens the snippets window. opts.src: the video's or sound file's address for 'video'
612
+ * and 'audio', in place of the sample, in the same undo step. */
613
+ addBlock(id: string, after?: Element, opts?: { src?: string }): HTMLElement[];
606
614
  /** Whether the site set a file picker for images (filePicker, imageSelect or onImageSelectClick). */
607
615
  hasImagePicker(): boolean;
616
+ /** Whether the site set a file picker for 'image', 'video' (videoSelect,
617
+ * onVideoSelectClick) or 'audio' (audioSelect, onAudioSelectClick). */
618
+ hasFilePicker(type?: 'image' | 'video' | 'audio'): boolean;
619
+ /** Open the site's file picker for that kind of file; callback gets the chosen
620
+ * address. False when the site set no picker for it. */
621
+ pickFile(type: 'image' | 'video' | 'audio', callback: (url: string) => void): boolean;
608
622
  /** Whether the site set an image upload (onImageUpload): only then does uploadImages()
609
623
  * upload; without one an embedded image stays in the page. */
610
624
  canUpload(): boolean;
625
+ /** Upload a file through the editor's upload (the site's handler, after the beforeUpload
626
+ * hook) and get its address; null when there is no upload or it failed. Uploads wait for
627
+ * each other. A video or sound file goes through onVideoUpload / onAudioUpload when set. */
628
+ upload(file: File | Blob): Promise<string | null>;
611
629
  /** Insert an image at the range (default: the current selection): the editor's own Insert
612
630
  * Image window opens (upload, an address, or Select from the site's picker). With
613
631
  * { picker: true } the site's file picker opens straight away and the chosen image goes
@@ -646,18 +664,25 @@ interface ContentBuilderAddonApi {
646
664
  unmarkRows(): void;
647
665
  /** The current selection inside the content, or null. */
648
666
  selection(): Range | null;
667
+ /** The block the user selected whole (a click or the arrow keys) that is not text: a plugin,
668
+ * a video, a spacer, a picture or drawing on its own line. Returns the column's child that
669
+ * holds it (what moving or removing acts on), or null. */
670
+ selectedBlock(): HTMLElement | null;
649
671
  /** Whether the editor has an element settings window (the element tool's Settings). */
650
672
  hasElementSettings(): boolean;
651
- /** Open the element settings window for el (a line in the content), as the element
652
- * tool's Settings does. False when there is none. */
673
+ /** Open the element settings window for el (a line of text, a spacer, a picture's line; not
674
+ * a plugin, which has its own), as the element tool's Settings does. False when there is none. */
653
675
  elementSettings(el: Element): boolean;
654
676
  /** Format the selected text as the text toolbar does: 'bold', 'italic', 'underline',
655
- * 'strikethrough', 'clean' (clear formatting; links stay), 'unlink', or 'link' (opens
677
+ * 'strikethrough', 'code' (inline code), 'clean' (clear formatting; links stay), 'unlink', or 'link' (opens
656
678
  * the editor's link window). One undo step. False when the selection is not in editable text. */
657
- format(command: 'bold' | 'italic' | 'underline' | 'strikethrough' | 'clean' | 'link' | 'unlink'): boolean;
658
- /** What the selected text is (block: the first line's tag; list: 'ul', 'ol' or null),
659
- * or null outside editable text. */
660
- formatState(): { bold: boolean; italic: boolean; underline: boolean; strikethrough: boolean; link: boolean; block: string | null; list: string | null } | null;
679
+ format(command: 'bold' | 'italic' | 'underline' | 'strikethrough' | 'code' | 'clean' | 'link' | 'unlink'): boolean;
680
+ /** What the selected text is (block: the first line's tag; list: 'ul', 'ol' or null;
681
+ * align: the line's own alignment or null), or null outside editable text. */
682
+ formatState(): { bold: boolean; italic: boolean; underline: boolean; strikethrough: boolean; code: boolean; link: boolean; block: string | null; list: string | null; align: 'left' | 'center' | 'right' | 'justify' | null } | null;
683
+ /** Align the lines the selection is in, as the text toolbar's Align does. One undo step.
684
+ * False outside editable text. */
685
+ align(value: 'left' | 'center' | 'right' | 'justify'): boolean;
661
686
  /** Turn the selected lines into another kind, keeping their text: 'p', 'h1' to 'h6',
662
687
  * 'blockquote', 'pre', or 'ul' / 'ol' (a list). One undo step. False when nothing changed. */
663
688
  setBlock(kind: string): boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@innovastudio/contentbuilder",
4
- "version": "1.5.228",
4
+ "version": "1.5.230",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "types": "index.d.ts",
@@ -4965,6 +4965,10 @@ div[data-html] {
4965
4965
  [data-cb-ui] .switch input:focus + .slider, .builder-ui .switch input:focus + .slider {
4966
4966
  box-shadow: 0 0 1px var(--cb-control-accent);
4967
4967
  }
4968
+ [data-cb-ui] .switch input:focus-visible + .slider, .builder-ui .switch input:focus-visible + .slider {
4969
+ outline: var(--cb-field-focus-outline, 2px solid var(--cb-accent));
4970
+ outline-offset: 2px;
4971
+ }
4968
4972
  [data-cb-ui] .switch input:checked + .slider:before, .builder-ui .switch input:checked + .slider:before {
4969
4973
  -webkit-transform: translateX(26px);
4970
4974
  -ms-transform: translateX(26px);
@@ -8389,7 +8393,9 @@ iframe.wait-autoplay {
8389
8393
  font-size: 1rem !important;
8390
8394
  }
8391
8395
  [data-cb-ui] .is-rte-pop.rte-addon-menu {
8392
- overflow: hidden;
8396
+ overflow-x: hidden;
8397
+ overflow-y: auto;
8398
+ max-height: min(480px, 60vh);
8393
8399
  height: auto;
8394
8400
  flex-direction: column;
8395
8401
  padding: 0;
@@ -8402,6 +8408,7 @@ iframe.wait-autoplay {
8402
8408
  [data-cb-ui] .is-rte-pop.rte-addon-menu button.rte-addon-item {
8403
8409
  width: 100%;
8404
8410
  height: 36px;
8411
+ flex: none;
8405
8412
  margin: 0;
8406
8413
  padding: 0 16px;
8407
8414
  display: flex;