-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: paste wysiwyg list #1230
fix: paste wysiwyg list #1230
Conversation
* @returns {number} depth | ||
* @private | ||
*/ | ||
_getContinuousDepth(el) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이건 스콰이어에서 자식 리스트를 li
하위가 아니라 nextSlibling
으로 생성하는 이슈 때문에 _getListDepth
와 분리해서 생성된 것이죠~?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앞에 전처리 과정에서 붙은 ul, li 태그들 때문에 추가된 depth를 현재 depth랑 비교하기 위해 추가하였습니다. 말이 조금 어렵네요..
_getRemovedUnnecessayListWrapper(el, orgEl) { | ||
while (el.querySelectorAll('ul,ol').length > orgEl.querySelectorAll('ul,ol').length) { | ||
el = el.firstChild; | ||
} | ||
return el; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 로직은 아래와 같은 경우를 처리할 때가 맞나요??
// el
<ul>
<li></li> ---> 반환
<ol>
<li></li>
</o>
</ul>
// orgEl
<ul>
<li></li>
</ul>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
만약에 복사한 원본 리스트가 아래와 같은데
<ul>
<li>
<ul>
<li></li>
</ul>
</li>
</ul>
기존에 전처리 로직을 타게 되면 아래처럼 depth를 더 추가해서 이상하게 변경하더라구요. 그래서 원본 데이터에 맞게 depth를 보정하는 내용입니다.
<ul>
<li>
<ul>
<li>
<ul>
<li></li>
</ul>
</li>
</ul>
</li>
</ul>
@@ -420,7 +420,7 @@ describe('WwPasteContentHelper', () => { | |||
|
|||
expect(element.childNodes.length).toEqual(1); | |||
expect(element.childNodes[0].tagName).toEqual('UL'); | |||
expect($(element.childNodes[0]).find('li > ul > li > ul > li').length).toEqual(2); | |||
expect($(element.childNodes[0]).find('li > div').length).toEqual(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
div
로 바뀐 이유는 무엇인가요~?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
불필요한 depth를 제거해서입니다~
[10/16] 리뷰 완료합니다! 역시나.. 간단하지 않은 이슈였군요 ㅜㅜ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[10/16] 리뷰완료
고생하셨습니다!
Please check if the PR fulfills these requirements
fix #xxx[,#xxx]
, where "xxx" is the issue number)Description
paste the wysiwyg list data considering current list depth
After fixing
Thank you for your contribution to TOAST UI product. 🎉 😘 ✨