I try to initialize tinyMCE to element, which placed in shadowDOM. (polymer web-components), but it's not work.
The same example of situation i found here: https://embed.plnkr.co/WXtcz2GUpOhgrhWBTcAW/
Do you have any ideas, how to initialize tinyMCE 4.9.3 for element in shadowDOM? (test on FireFox 65.0.2, Chrome 72.0.3626.121)
Put the TinyMCE <textarea>
in the light DOM.
Insert it in the Shadow DOM by the help of a <slot>
element.
class MyElement extends HTMLElement {
connectedCallback() {
const textarea = document.createElement('textarea')
this.appendChild(textarea)
this.attachShadow({ mode: 'open' })
.innerHTML=`<style>
:host { outline: 5px solid blue ; display: inline-block }
</style>
<slot></slot>`
tinymce.init({
target: textarea
})
}
}
customElements.define('my-element', MyElement)
<script data-require="[email protected]" data-semver="4.4.3" src="https://cdn.tinymce.com/4/tinymce.min.js"></script>
<my-element></my-element>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With