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

when typing markdown and the windows has to scroll and "scroll-on" an error occur #956

Open
marcnicole opened this issue Apr 28, 2020 · 6 comments
Labels

Comments

@marcnicole
Copy link

marcnicole commented Apr 28, 2020

Describe the bug

the bug is located in getCmRangeHeight(mdNode, cm) which calls getNextEmptyLineHeight with only 2 parameters instead of 3 and cause getNextEmptyLineHeight to crash

image

(screen shot are on toastui-editor 2.0.1, just modified to debug)

To Reproduce

simply type a lot of new line in the markdown, when it has to scroll it will soon cause the error

Expected behavior

simply correct the return statement as shown above

Screenshots

we see here the root cause of the problem: one parameter is invalid
image

Desktop (please complete the following information):

  • OS: Windows (but OS independent)
  • Browser chrome
  • Version 81.0.4044.122
@marcnicole marcnicole added the Bug label Apr 28, 2020
@seonim-ryu
Copy link
Member

@marcnicole
Thank you for explaining in detail! 👍 But I can't reproduce, can you show me what the situation is with an image like a gif? And can you check if it happens in the example page below?

https://nhn.github.io/tui.editor/latest/tutorial-example01-editor-basic

@marcnicole
Copy link
Author

@seonim-ryu
I can't reproduce the problem on https://nhn.github.io/tui.editor/latest/tutorial-example01-editor-basic, but I can't check the source code neither because it is webpacked / minimized .

I used the npm deployement...so I have a single large file. I will look if I can find the difference in the source. maybe an issue with the npm package... I will look , but I need some time

@seonim-ryu
Copy link
Member

@marcnicole Looking at the screenshot you gave me again, I think the location of the offending code is here.

let detailLineInfo = lineInfo.handle;

But to debug, I have to reproduce the current situation, but I can't reproduce it, so it's difficult to solve this problem..

@HiroyukiNIshimura
Copy link

When I handle Null, it’s cured.

before

while (start <= end && !detailLineInfo.text.trim()) {
  height += detailLineInfo.height;
  start += 1;
  detailLineInfo = cm.lineInfo(start).handle;
}

after

while (start <= end && !detailLineInfo.text.trim()) {
  height += detailLineInfo.height;
  start += 1;
  if (!cm.lineInfo(start)) {
    break;
  }
  detailLineInfo = cm.lineInfo(start).handle;
}

@ndhhien27
Copy link

This bug still occurs in React. Does someone have a solution to fix it?

@ndhhien27
Copy link

The error occurs when we scroll in the write tab with a empty line at the end of editor

js87zz pushed a commit that referenced this issue Jun 17, 2021
* develop: (28 commits)
  fix: missing style link
  fix: broken code block preview style
  chore: add remap coverage
  chore: change css build process back to as it is
  fix: broken demo lib path
  Feature/code block editor (#959)
  chore: npm run bundle -> npm run build
  chore: webpack dev server should accept connections beside localhost
  fix: add missing function after merge
  Feature/code block editor (#956)
  feature: load selected text onto add link popup
  feat: add api for inserting text on cursor
  chore: need to specify browser to test
  fix(clipboard): pasting url should not decode %20
  fix: popup size for small screen
  style: remove debug alter in test
  feat(ww): codeblock language selection
  feat(ww): add source param in addImageBlobHook
  Hotfix/ww in table (#948)
  chore: squire dependency update
  ...

# Conflicts:
#	bower.json
#	dist/tui-editor.css
#	dist/tui-editor.js
#	dist/tui-editor.min.js
#	src/css/tui-editor.css
#	src/js/editor.js
#	src/js/importManager.js
#	src/js/langs/nl_NL.js
#	src/js/ui/defaultUI.js
#	src/js/ui/popupAddImage.js
#	src/js/ui/popupAddLink.js
#	src/js/wwTableSelectionManager.js
#	src/js/wysiwygEditor.js
#	test/ui/popupAddImage.spec.js
#	test/ui/popupAddLink.spec.js
#	test/wysiwygEditor.spec.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants