Make some element unediatble by default.
Question
@artf how can we set some configuration so that while importing html in editor it will not consider some element as text component and it should consider as inside text of the parent.
eg.. <p> here is some example text.<span> Do not make it as text component </span> Example text 2 </p>
I don't want to make span as text component as P is already editable. I can not set data-js-editable as false. because it need to
update multiple places. So I want to know that there is any way where I can put that span like element
will not convert to text component.
Thank You!
Answers (2)
Extend the text component type and implement your logic in isComponent. If the element meets your conditions (you would probably check for inner elements) just return the object in this way
isComponent(el) {
// ...
if (isWhatYouNeed) {
return {
type: 'text',
content: el.innerHTML,
components: [],
// By putting components you prevent the parser
// from going deeper traversing of your DOM elements
}
}
},
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1836
How to add !important in all the generated apis
Hello @artf, While i am going to edit some html from editor with the help of css then i need to add !important into all the css which is ch...
Issue #2061
[QUESTION] How to place a component at the end of the canvas.
How can I put my footer at the end of the canvas? I want the editor to not allow placing a block/widget below the footer. example
Issue #509
Span are not editable as text
Hello Artf, I have a problem when importing some html templates. I was initially not able to see span texts. But after helping the editor r...
Issue #1255
[QUESTION]: How to set editor html contents from custom component?
I'm having trouble getting a custom block+component to display its template HTML inside the grapes editor. Within the exported HTML, the ma...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.