Skip to content

Commit fbf9bb1

Browse files
Apply suggestions from code review
Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
1 parent b55ae26 commit fbf9bb1

File tree

8 files changed

+9
-14
lines changed

8 files changed

+9
-14
lines changed

packages/decap-cms-widget-markdown/src/serializers/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,8 @@ export function markdownToSlate(markdown, { voidCodeBlock, remarkPlugins = [] }
220220
* trees.
221221
*/
222222
export function slateToMarkdown(raw, { voidCodeBlock, remarkPlugins = [] } = {}) {
223-
console.log('old raw', raw);
224223
const mdast = slateToRemark(raw, { voidCodeBlock });
225-
console.log('old mdast', mdast);
226224
const markdown = remarkToMarkdown(mdast, remarkPlugins);
227-
console.log('old md', markdown);
225+
228226
return markdown;
229227
}

packages/decap-cms-widget-richtext/src/RichtextControl/VisualEditor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default function VisualEditor(props) {
7979
}
8080

8181
function handleChange({ value }) {
82-
// console.log('handleChange', value);
82+
8383
const mdValue = slateToMarkdown(
8484
value,
8585
{ voidCodeBlock: !!codeBlockComponent },

packages/decap-cms-widget-richtext/src/RichtextControl/components/Element/ListElement.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ import React from 'react';
22
import styled from '@emotion/styled';
33
import { PlateElement } from 'platejs/react';
44

5-
const bottomMargin = '16px';
6-
75
const StyledList = styled.li`
8-
margin-bottom: ${bottomMargin};
6+
margin-bottom: 16px;
97
padding-left: 30px;
108
`;
119

packages/decap-cms-widget-richtext/src/RichtextControl/linkHandler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function handleLinkClick({ editor, t }) {
44
const url = window.prompt(t('editor.editorWidgets.markdown.linkPrompt'), '');
55
if (url) {
66
upsertLink(editor, { url, skipValidation: true });
7-
} else if (url == '') {
7+
} else if (url === '') {
88
unwrapLink(editor);
99
}
1010
}

packages/decap-cms-widget-richtext/src/RichtextControl/plugins/ExtendedBlockquotePlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function isWithinBlockquote(editor, entry) {
88
}
99

1010
function queryNode(editor, entry, { empty, first, start, collapsed }) {
11-
console.log('collapsed', editor.api.isCollapsed());
11+
1212
return (
1313
(!empty || editor.api.isEmpty(entry[1])) &&
1414
(!first || !PathApi.hasPrevious(entry[1])) &&

packages/decap-cms-widget-richtext/src/__tests__/renderer.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ I get 10 times more traffic from [Google] than from [Yahoo] or [MSN].
191191
});
192192

193193
describe('HTML sanitization', () => {
194-
it('should sanitize HTML', async () => {
194+
it('should sanitize HTML', () => {
195195
const value = `<img src="foobar.png" onerror="alert('hello')">`;
196196
const field = Map({ sanitize_preview: true });
197197

@@ -208,7 +208,7 @@ I get 10 times more traffic from [Google] than from [Yahoo] or [MSN].
208208
expect(img).not.toHaveAttribute('onerror');
209209
});
210210

211-
it('should not sanitize HTML', async () => {
211+
it('should not sanitize HTML', () => {
212212
const value = `<img src="foobar.png" onerror="alert('hello')">`;
213213
const field = Map({ sanitize_preview: false });
214214

packages/decap-cms-widget-richtext/src/schema.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export default {
88
enum: [
99
'bold',
1010
'italic',
11+
'strikethrough',
1112
'code',
1213
'link',
1314
'heading-one',

packages/decap-cms-widget-richtext/src/serializers/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,8 @@ export function markdownToSlate(
227227
* trees.
228228
*/
229229
export function slateToMarkdown(raw, { voidCodeBlock, remarkPlugins = [] } = {}, editorComponents) {
230-
console.log('new raw', raw);
231230
const mdast = slateToRemark(raw, { voidCodeBlock }, editorComponents);
232-
console.log('new mdast', mdast);
233231
const markdown = remarkToMarkdown(mdast, remarkPlugins, editorComponents);
234-
console.log('new md', markdown);
232+
235233
return markdown;
236234
}

0 commit comments

Comments
 (0)