-
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
feat: convert list copied from ms office to standard list element in wysiwyg #1153
Conversation
// In our viewer case, <p>aaa</p><p>bbb<p> have empty line becuase P tags have margin. | ||
// In MS Office case, <p>aaa</p><p>bbb<p> do not have empty line becuase P tags means just one line. | ||
if (!this._isFromMs(clipboardContainer.innerText)) { | ||
if (isCopiedFromMso(clipboardContainer.innerHTML)) { |
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.
참조 : 기존에
innerText
로 체크했는데 이 경우 텍스트를 검사하는 것이기 때문에 태그에 포함된mso-
프리픽스 값을 체크할 수 없어서innerHTML
로 수정함
_listElementAid(container) { | ||
const wwListManager = this.wwe.componentManager.getManager('list'); | ||
|
||
container.innerHTML = wwListManager.convertToArbitraryNestingList(container.innerHTML); | ||
} |
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.
참조 : IE11에서 MS Office의 리스트를 붙여넣기 하면 다른 브라우저와 다르게 리스트 엘리먼트로 데이터가 들어온다. 이 경우 Squire의 리스트 구조에 맞게 자식 리스트의 위치를 변경해줘야 한다. 이를 처리하기 위한 로직으로 추가함
- 표준 리스트 마크업 구조
<ul>
<li>
foo
<ul>
<li>bar</li>
</ul>
</li>
<li>baz</li>
</ul>
- Squire 리스트 마크업 구조
<ul>
<li>foo</li>
<ul>
<li>bar</li>
</ul>
<li>baz</li>
</ul>
e84154d
to
e438c35
Compare
if ( !hasImage ) { | ||
items = null; | ||
} |
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.
참조 : 이 로직으로 인해서 Edge에서
type === 'text/html'
의 클립보드 데이터를 가져오지 못한다. 주석 내용에 따르면 구형 Edge를 대응할 목적으로 보이는데 이 부분은 Squire 이슈로 등록하여 관리할 예정임
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.
이 부분은 두레이 task에 같이 히스토리로 남겨놓는게 좋을 것 같습니다~!
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.
넵~ Squire에 이슈 등록하고 같이 업데이트 해둘게요~
Squire 등록 이슈 : fastmail/Squire#389
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.
[08/20] 리뷰완료
고생하셨습니다!
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.
수고하셨어요
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.
고생하셨습니다!
Please check if the PR fulfills these requirements
fix #xxx[,#xxx]
, where "xxx" is the issue number)Description
Bug Fix
If you copy and paste the list from MS Office in WYSIWYG, it is pasted as plain text as follows.
In Chrome, Edge, and IE10, it is pasted as above. However, in IE11, the list is pasted as it is, but the list item with children is shown as newline as follows.
When pasting, the clipboard data copied from MS Office must be parsed and processed into a list element of the WYSIWIG editor. In MS Office, the copied list is created as a paragraph, and in this case, the list is created with the attribute value of a specific class (
MsoListParagraph
) or style (mso-list
).In MS Office, the clipboard data is as follows when copied and pasted into the WYSIWIG editor.
List elements created after processing are as follows. Note that the WYSIWIG editor uses Squire. Because of the list structure created at this time, the child list (
li > ul
) is created as the next element, not as a child of the list item.Result
Finally, the list should be pasted in the following format.
Chrome
Edge
IE11
IE10
Thank you for your contribution to TOAST UI product. 🎉 😘 ✨