1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-08-24 20:19:10 +02:00

Compare commits

...

7 Commits

3 changed files with 15 additions and 1 deletions

View File

@@ -515,6 +515,9 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
}
`));
// const iframe = document.getElementsByTagName('iframe')
// console.log(iframe)
return () => {
document.head.removeChild(element);
};
@@ -568,6 +571,12 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
'h1', 'h2', 'h3', 'hr', 'blockquote', 'table', `joplinInsertDateTime${toolbarPluginButtons}`,
];
const contentStyle = `
.jop-tinymce p {
margin: 0;
}
`;
const editors = await (window as any).tinymce.init({
selector: `#${rootIdRef.current}`,
width: '100%',
@@ -601,6 +610,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
joplinSup: { inline: 'sup', remove: 'all' },
code: { inline: 'code', remove: 'all', attributes: { spellcheck: false } },
},
content_style: contentStyle,
setup: (editor: Editor) => {
editor.addCommand('joplinAttach', () => {
insertResourcesIntoContentRef.current();

View File

@@ -12,6 +12,10 @@ describe('htmlUtils', () => {
'line 1\nline 2',
'<p>line 1</p><p>line 2</p>',
],
[
'line 1\n\rline 2',
'<p>line 1</p><p>line 2</p>',
],
[
'<img onerror="http://downloadmalware.com"/>',
'&lt;img onerror=&quot;http://downloadmalware.com&quot;/&gt;',

View File

@@ -176,7 +176,7 @@ export default new HtmlUtils();
export function plainTextToHtml(plainText: string): string {
const lines = plainText
.replace(/[\n\r]/g, '\n')
.replace(/(\n\r)/g, '\n')
.split('\n');
const lineOpenTag = lines.length > 1 ? '<p>' : '';