Skip to content

Commit 84b79a1

Browse files
authored
DOC-3223: Added support for loading web components into iframes. (#3888)
* DOC-3223: Added support for loading web components into iframes. * DOC-3223: Add link to api docs for new getComponentUrls.
1 parent 823843b commit 84b79a1

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

modules/ROOT/pages/8.2.0-release-notes.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ For information on using Enhanced Skins & Icon Packs, see: xref:enhanced-skins-a
7373

7474
{productname} 8.2.0 also includes the following addition<s>:
7575

76+
=== Added support for loading web components into iframes
77+
// #TINY-13006
78+
79+
Previously, there was no method to load web components into the editor iframe or preview iframes used by other plugins, which prevented these components from rendering correctly. This limitation impacted users who relied on custom web components for extended editor functionality or content visualization. In {release-version}, a new API link:https://www.tiny.cloud/docs/tinymce/latest/apis/tinymce.html.schema/#getComponentUrls[getComponentUrls] has been introduced that allows specifying a script URL for the web component within the custom element schema. This enhancement enables web components to be properly registered and rendered within the {productname} editor environment.
80+
81+
For an example of using custom elements with block-level and inline-level components, see: xref:content-filtering.adoc#example-using-custom_elements-with-block-level-and-inline-level-components[Example using `+custom_elements+` with block-level and inline-level components].
82+
7683
// === <TINY-vwxyz 1 changelog entry>
7784
// #TINY-vwxyz1
7885

modules/ROOT/partials/configuration/custom_elements.adoc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ tinymce.init({
1919
* **Custom Element Structure:** The custom_elements option and the `addCustomElements` API supports more complex structures. This structure is defined by a record where the key represents the name of the element, and the value corresponds to a detailed specification.
2020
* **Attributes and Inheritance:** Elements inherit attributes and children from other specified elements using the `+extends: "div"+` property in the `custom_elements` spec.
2121
* **Attribute and Children Specifications:** The `custom_elements` spec includes properties such as `attributes` which lists attribute names, or `children` which lists valid child element names. The `children` property includes presets like `@global`, `@blocks`, `@phrasing`, and `@flow`.
22+
* **Web Components Support:** Custom elements can specify a `+componentsUrl+` property to load web component scripts into the editor.
2223

2324
HTML Element Sets: The exact element sets for each preset, depending on the schema set (html4, html5, or html5-strict), can be found in the below tables.
2425

@@ -96,4 +97,29 @@ tinymce.init({
9697
});
9798
},
9899
});
100+
----
101+
102+
=== Example using `+custom_elements+` with block-level and inline-level components.
103+
104+
[source, js]
105+
----
106+
tinymce.init({
107+
selector: "textarea",
108+
custom_elements: {
109+
// Block-level custom element (behaves like a div)
110+
"my-custom-block": {
111+
extends: "div",
112+
attributes: ["@global", "data-type", "data-id"],
113+
children: ["@flow"],
114+
componentsUrl: "/path/to/block-component.js"
115+
},
116+
// Inline-level custom element (behaves like a span)
117+
"my-custom-inline": {
118+
extends: "span",
119+
attributes: ["@global", "data-value"],
120+
children: ["@phrasing"],
121+
componentsUrl: "/path/to/inline-component.js"
122+
}
123+
}
124+
});
99125
----

0 commit comments

Comments
 (0)