-
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: encode link url unnecessarily #1641
Conversation
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.
리뷰 완료합니다.
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.
리뷰 완료합니다
apps/editor/src/utils/encoder.ts
Outdated
const encodingRegExps = [/\(/g, /\)/g, /\[/g, /\]/g, /</g, />/g, / /g]; | ||
const encodedList = ['%28', '%29', '%5B', '%5D', '%3C', '%3E', '%20']; | ||
const escapedList = ['\\(', '\\)', '\\[', '\\]', '\\<', '\\>', ' ']; |
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.
배열들이 나란히 있어서 눈에 들어오긴 하는데, 각각의 encodingRegExp, encoded, escaped 가 한묶음씩 보인다면 가독성이 나아질지도 모르겠네요. 드물겠지만 새로운 변환 규칙 추가할 때 하나라도 빼먹는 것을 방지할 수 있겠고요. 막상 예제를 만들어보니까 코드 양이 좀 불필요하게 늘어나는 것 같긴 하지만요.
const encoderList = [
{
target: /\(/g,
result: { encoded: '%28', escaped: '\\(' }
},
// ...
];
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.
더 복잡해지는 것 같아서 아래처럼 맵을 사용하되 좀 더 축약했습니다~
const encoderList = [
{
regExp: /\(/g,
encoded: '%28',
escaped: '\\(',
},
{
regExp: /\)/g,
encoded: '%29',
escaped: '\\)',
},
{
regExp: /\[/g,
encoded: '%5B',
escaped: '\\[',
},
{
regExp: /\]/g,
encoded: '%5D',
escaped: '\\]',
},
{
regExp: /</g,
encoded: '%3C',
escaped: '\\<',
},
{
regExp: />/g,
encoded: '%3E',
escaped: '\\>',
},
{
regExp: / /g,
encoded: '%20',
escaped: ' ',
},
];
3d7e36c
to
d5d6c56
Compare
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.
리뷰 완료합니다. 수고하셨어요.
* fix: decode url when executing addImage, addLink command * chore: add test case(addImage, addLink) * chore: apply code review * refactor: assertToContainHTML function * chore: add test case(converting the html block which has "=" attr value)
Please check if the PR fulfills these requirements
fix #xxx[,#xxx]
, where "xxx" is the issue number)Description
Thank you for your contribution to TOAST UI product. 🎉 😘 ✨