Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can templates be set to add content rather than replace all? #412

Closed
AversaConsulting opened this issue Jun 22, 2020 · 6 comments
Closed
Milestone

Comments

@AversaConsulting
Copy link

AversaConsulting commented Jun 22, 2020

Firstly - fantastic work - and speed on fixes!

Just wondering if it's possible (can't see a way) of having templates append content rather than replacing all the content. I have some now working to show a uk-grid for getuikit - but it would be nice to be able to add multiple templates to existing content.

template example is:

<div class="se-component" uk-grid>
  <div class="uk-width-1-3@m">1/3</div>
  <div class="uk-width-2-3@m">2/3</div>
</div>

Also if I try to add an image into one of the grid's divs, all kind of strange things happen and it adds extra divs rather than placing in the one where the cursor is.

<div class="se-component uk-grid" uk-grid="">
<div class="uk-width-1-3@m uk-first-column">Left cell</div>

<div class="uk-width-2-3@m">Right Cell</div>
</div><div class="se-component se-image-container __se__float-none" contenteditable="false">
    <figure style="margin: 0px;">
        <img src="/image/blog/4PLBL4-JJTKTL@NZW3FG@FULL" alt="" data-rotate="" data-proportion="true" data-rotatex="" data-rotatey="" data-size="," data-align="none" data-percentage="auto,auto" data-index="0" data-file-name="4PLBL4-JJTKTL@NZW3FG@FULL" data-file-size="38505" data-origin="," style="">
    </figure>
</div><div class="se-component uk-grid uk-grid-stack" uk-grid="">
<div class="uk-width-2-3@m uk-first-column">​</div>
</div>

Cheers
Nick

@JiHong88
Copy link
Owner

JiHong88 commented Jun 23, 2020

Type of editor format:
|-format tag: p..
| |- free format tag pre..
| | |- closure free format tag
|-range format tag th, td..
| |-closure range format tag th, td
|-component wrapper div of image

format tag:
All text or other tags should be included in the "format".
If there are no more "format", the "format" is maintained without being erased by the backspace key.

free format tag:
"free format" is included in the "format", but the Enter key create "br" tag.
"free format" is deleted with backspace key when there is no child nodes.
You can get out of "free format" with the Enter key in the last line.
"free format" is would be deleted with backspace key.

component:
"component" is could not included in the "format" or "free format".
Inserting "component" splits "format" based on cursor position.

<p>123|456</p>
->>
<p>123</p>
<div class="se-component"></div>
<p>456</p>

range format tag:
"range format" is could be included "format tag", "component"
"range format" is would be deleted with backspace key.
You can get out of "range format" with the Enter key in the last line.
"range format" is would be deleted with backspace key.

closure free format tag, closure range format tag:
It has the same attributes as each format tag, but you cannot exit this format with the Enter key or Backspace key.


Therefore, to insert an image, it must be of the following structure.

<div class="se-component" uk-grid="">
	<div class="uk-width-2-3@m __se__format__range__closure_xxx">
		<div>1111</div> // format tag
	</div>
	<div class="uk-width-2-3@m __se__format__range__closure_xxx">
		<div>2222</div> // format tag
	</div>
</div>

"ClosureRangeFormatElement" is not added yet.
I will notify you know after the version update.

@JiHong88 JiHong88 added this to the 2.30.5 milestone Jun 23, 2020
JiHong88 added a commit that referenced this issue Jun 23, 2020
@AversaConsulting
Copy link
Author

Brilliant thanks!

@JiHong88
Copy link
Owner

The 2.30.5 version has been updated.
If this issue has not been resolved, please reopen this issue.
Thank you.

@AversaConsulting
Copy link
Author

The templates are working well now for images - but when you select a template it replaces the existing content. So if I have some content already and select a template, the existing content is deleted. Is there any way round this?
Thanks

@JiHong88
Copy link
Owner

"Template" is not a button used to add something.
It is just a button to add a pre-written template throughout the editor.
Please create and use custom plugins.
http://suneditor.com/sample/html/customPlugins.html

@AversaConsulting
Copy link
Author

Ok thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants