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

fix: focus with colorsyntax on multi instances (fix #2413) #2441

Merged
merged 4 commits into from
Apr 14, 2022

Conversation

jajugoguma
Copy link
Contributor

Please check if the PR fulfills these requirements

  • It's the right issue type on the title
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • It does not introduce a breaking change or has a description of the breaking change

Description

  • Fixed that set focus to the first editor when using the color syntax plugin in multi-instance.
    • Changed to find the editing area element in the parent element (Editor Container element) of the dropdown element of the current color syntax plugin.
    • The process of finding an edit area element has been changed to before moving focus into the editor, rather than when the editor has focus set.

As-Is

To-Be


Thank you for your contribution to TOAST UI product. ๐ŸŽ‰ ๐Ÿ˜˜ โœจ

Copy link

@adhrinae adhrinae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฆฌ๋ทฐ ์™„๋ฃŒํ•ฉ๋‹ˆ๋‹ค. ํ…Œ์ŠคํŠธ ๋ถ€๋ถ„ ํ™•์ธํ•ด์ฃผ์‹œ๊ณ ์š”.
๊ทธ๋ฆฌ๊ณ  ๋‹ค๋ฅธ ํ”Œ๋Ÿฌ๊ทธ์ธ์—๋„ ์ด๋ฒˆ ์ด์Šˆ๋ž‘ ๋น„์Šทํ•œ ๊ฒฝ์šฐ๊ฐ€ ์ผ์–ด๋‚  ์ผ์€ ์—†๋‚˜์š”?
์—ฌ๋Ÿฌ ์ธ์Šคํ„ด์Šค๋ฅผ ๋งŒ๋“ค์–ด๋†“๊ณ  ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์‚ฌ์šฉํ•  ๋•Œ ํ˜„์žฌ ํฌ์ปค์Šค์ค‘์ธ ์—๋””ํ„ฐ๋ฅผ ๋” ์‰ฝ๊ฒŒ ์ฐพ์„ ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์„ ๊ธฐ๋ณธ์ ์œผ๋กœ ๋งˆ๋ จํ•˜๋Š”๊ฒŒ ์ข‹๊ฒ ๋Š”๋ฐ์š”.

Comment on lines 284 to 286
expect(document.activeElement).toBe(
container2.querySelector('.toastui-editor-md-container .ProseMirror')
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ˜น์‹œ container2.contains(document.activeElement) ๋กœ๋Š” ์•ˆ๋˜๋‚˜์š”?

https://developer.mozilla.org/en-US/docs/Web/API/Node/contains

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ˜„์žฌ activeElement๊ฐ€ ์ •ํ™•ํžˆ ์—๋””ํ„ฐ ๋‚ด ์—๋””ํŒ… ์š”์†Œ์ธ์ง€ ํ™•์ธํ•˜๋Š”๊ฒŒ ๋ช…ํ™•ํ•˜๋‹ค๊ณ  ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋„ค ๊ทธ๋Ÿฐ๋ฐ ์ € ์ฟผ๋ฆฌ ์…€๋ ‰ํ„ฐ๋Š” ๋‹ค๋ถ„ํžˆ ๊ตฌํ˜„ ์˜์กด์ ์ธ๋ฐ ๋น„ํ•ด
"document.activeElement ๊ฐ€ ์–ด์จŒ๋“  container2 ์•ˆ์— ์žˆ๋Š”๊ฑฐ๋ƒ" ๋ฅผ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด contains ๋ฅผ ์“ฐ๋Š”๊ฒŒ ์–ด๋–ป๊ฒ ๋ƒ๋Š” ์˜๋ฏธ์—ฌ์š”.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ตฌํ˜„ ์˜์กด์ ์ด๋ผ๋Š”๋ฐ ๋™๊ฐํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ง์”€ํ•˜์‹  ๊ฒƒ์ฒ˜๋Ÿผ ์š”์†Œ๋ฅผ ํฌํ•จํ•˜๋Š”์ง€ ๊ฒ€์ฆํ•˜๋„๋ก ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค.

Copy link
Contributor

@jwlee1108 jwlee1108 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฆฌ๋ทฐ ์™„๋ฃŒํ•ฉ๋‹ˆ๋‹ค.

@jajugoguma jajugoguma merged commit 29f7080 into master Apr 14, 2022
@jajugoguma jajugoguma deleted the fix/focus-with-colorsyntax-on-multi-instances branch April 14, 2022 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants