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

Insert image at list with line break #552

Closed
sohee-lee7 opened this issue Jun 20, 2019 · 2 comments · Fixed by OpenTMI/opentmi-default-gui#28 · May be fixed by christian7877/toast-ui.vue-editor#1
Closed

Insert image at list with line break #552

sohee-lee7 opened this issue Jun 20, 2019 · 2 comments · Fixed by OpenTMI/opentmi-default-gui#28 · May be fixed by christian7877/toast-ui.vue-editor#1

Comments

@sohee-lee7
Copy link
Contributor

Version

v1.4.3

Test Environment

Chrome

Current Behavior

When insert image at the list with line break and change mode to wysiwyg,
line break disappear.

Screen Recording 2019-06-20 at 10 19 36 AM mov

Expected Behavior

Line break should be kept.

@seonim-ryu
Copy link
Member

seonim-ryu commented Jul 31, 2019

Current

Case 1 : If there is only an image after the last <br> (Issue!)

Markdown

스크린샷 2019-07-31 오후 12 48 15

스크린샷 2019-07-31 오후 12 53 39

Wysiwyg

스크린샷 2019-07-31 오후 12 54 44

스크린샷 2019-07-31 오후 12 53 51

Case 2: If there is only text after the last <br>

Markdown

스크린샷 2019-07-31 오후 12 58 26

스크린샷 2019-07-31 오후 12 58 41

Wysiwyg

스크린샷 2019-07-31 오후 12 59 22

스크린샷 2019-07-31 오후 6 16 35

Case 3: If there is the image and some text as inline after the last <br>

Markdown

스크린샷 2019-07-31 오후 6 13 04

스크린샷 2019-07-31 오후 6 13 50

Wysiwyg

스크린샷 2019-07-31 오후 6 13 14

스크린샷 2019-07-31 오후 6 15 57

Cause

  • The case 1 situation occurred because the img tag was not recognized when determining the line break in the squire.

Result

  • Fix the logic of the squire.

@seonim-ryu
Copy link
Member

seonim-ryu commented Aug 4, 2019

Current

  • Add <br> between <br> to <img> before calling setValue of the WWE. (Change from <br><img> to <br><br><img>)
// wysiwygEditor.spec.js
const case1 = 'test<br><img src="" />'; // success
const case2 = 'test<br>\u200B<img src="" />'; // success
const case2 = 'test<br>\n<img src="" />'; // fail
  • If removing preprocessor of setValue above then the line break is not working between the text and the image.
editor.getCurrentModeEditor().setValue('test<br><img src="" />');
// or
editor.getCurrentModeEditor().setValue('<a href="#">test<br><img src="" /></a>');

seonim-ryu pushed a commit that referenced this issue Jan 2, 2020
ww: codeBlock에서 selection 이후 text까지 삭제되는 문제 해결
seonim-ryu added a commit that referenced this issue Jan 2, 2020
* feat: remove that <br> is added before <img> (fix #552)

* feat: change imported squire file

* fix: change logic to import squire module

* chore: edit test case spec

* chore: test to fixed squire

* feat: update forked version of squire
seonim-ryu pushed a commit that referenced this issue Jan 6, 2020
ww: codeBlock에서 selection 이후 text까지 삭제되는 문제 해결
seonim-ryu added a commit that referenced this issue Jan 6, 2020
* feat: remove that <br> is added before <img> (fix #552)

* feat: change imported squire file

* fix: change logic to import squire module

* chore: edit test case spec

* chore: test to fixed squire

* feat: update forked version of squire
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment