Samuell1 / contenteditor-plugin

Edit your content in page - plugin for OctoberCMS
http://octobercms.com/plugin/samuell-contenteditor
MIT License
39 stars 19 forks source link

Inserting multiple blocks in page has errors #81

Open SplicedWeb opened 5 years ago

SplicedWeb commented 5 years ago

Inserted {% component 'contenteditor' file="filename_in_content1.htm" %}

Then later on page {% component 'contenteditor' file="filename_in_content2.htm" fixture="h3" class="media" %}

Then again later on page {% component 'contenteditor' file="filename_in_content3.htm" tools="left-align,right-align" %}

the 3rd instance is rendered as h3 ?

Samuell1 commented 5 years ago

@SplicedWeb For temporary fix you can create other component and use only that for fixtures. I wasnt able to find a fix for this for now. Looks like components in octobercms are sharing properties together and that is the issue.

SplicedWeb commented 5 years ago

Thanks Samuell1, I'm not sure I understand your fix though.

Samuell1 commented 5 years ago

Like this. Just adding ContentEditor component in page and using this component name in your code.

obrázok

SplicedWeb commented 5 years ago

Thanks so much for clarifying

PubliAlex commented 4 years ago

another solution is to declare a fixture="" to the third element, otherwise, it will get the fixture of the last used element. Same for class

{% component 'contenteditor' file="filename_in_content1.htm" %}

{% component 'contenteditor' file="filename_in_content2.htm" fixture="h3" class="media" %}

{% component 'contenteditor' file="filename_in_content3.htm" tools="left-align,right-align" fixture="" class="" %}

Samuell1 commented 4 years ago

@PubliAlex yep or that i was thinking to separate fixture and main editor to different components to prevent this issue but it will be backwards incompatible.

jonathan-hc commented 4 years ago

I just posted https://github.com/Samuell1/contenteditor-plugin/issues/101 and it looks like my problem is related. I have more than 10 instances of contentbuilder in my template in some cases, but I'm inserting the component in the layout only once. I do that because I don't want the entire HTML to be edited, only the text within individual h? or p tags Do I need to add the component 10 times in that case? That seems very impractical.

Samuell1 commented 4 years ago

@jonathan-hc Yes, its because one component in page is same component it doesnt initialize per tag, i tried to somehow to find a solution but still nothing.

Conobi commented 4 years ago

I don't want the entire HTML to be edited, only the text within individual h? or p tags Do I need to add the component 10 times in that case? That seems very impractical.

Same issue here, it would be so cool to have a simpler syntax for editing a single tag, a bit like does this plugin: https://octobercms.com/plugin/fw-editme

PubliAlex commented 2 years ago

Another issue related to multiple blocks, it instanciate StylePalette multiple times :

image

As a result, styles are displayed multiple times :

image

EDIT : I add a precision, it does that when the content editor is called inside partials, cause, for each partials, the renderCount variable restart to 1. That variable should be more "global" and not restart for the whole page

PubliAlex commented 2 years ago

Created a PR #117 that fix the issue of multiple StylePalette