pull/3164/head
Laurent Cozic 2020-05-04 18:37:22 +01:00
parent 3f8833eaf1
commit 9a2f0bee29
5 changed files with 5 additions and 21 deletions

View File

@ -228,9 +228,6 @@ function AceEditor(props: NoteBodyEditorProps, ref: any) {
useImperativeHandle(ref, () => { useImperativeHandle(ref, () => {
return { return {
content: () => props.content, content: () => props.content,
setContent: (body: string) => {
aceEditor_change(body);
},
resetScroll: () => { resetScroll: () => {
resetScroll(); resetScroll();
}, },
@ -246,11 +243,6 @@ function AceEditor(props: NoteBodyEditorProps, ref: any) {
throw new Error(`Unsupported scroll options: ${options.type}`); throw new Error(`Unsupported scroll options: ${options.type}`);
} }
}, },
clearState: () => {
if (!editor) return;
editor.clearSelection();
editor.moveCursorTo(0, 0);
},
supportsCommand: (/* name:string*/) => { supportsCommand: (/* name:string*/) => {
// TODO: not implemented, currently only used for "search" command // TODO: not implemented, currently only used for "search" command
// which is not directly supported by Ace Editor. // which is not directly supported by Ace Editor.

View File

@ -199,9 +199,6 @@ const TinyMCE = (props:NoteBodyEditorProps, ref:any) => {
if (!editorRef.current) return ''; if (!editorRef.current) return '';
return prop_htmlToMarkdownRef.current(props.contentMarkupLanguage, editorRef.current.getContent(), props.contentOriginalCss); return prop_htmlToMarkdownRef.current(props.contentMarkupLanguage, editorRef.current.getContent(), props.contentOriginalCss);
}, },
setContent: (/* body: string*/) => {
console.warn('TinyMCE::setContent - not implemented');
},
resetScroll: () => { resetScroll: () => {
if (editor) editor.getWin().scrollTo(0,0); if (editor) editor.getWin().scrollTo(0,0);
}, },
@ -220,11 +217,6 @@ const TinyMCE = (props:NoteBodyEditorProps, ref:any) => {
} else { } else {
throw new Error(`Unsupported scroll options: ${options.type}`); throw new Error(`Unsupported scroll options: ${options.type}`);
} }
},
clearState: () => {
console.warn('TinyMCE::clearState - not implemented');
}, },
supportsCommand: (name:string) => { supportsCommand: (name:string) => {
// TODO: should also handle commands that are not in this map (insertText, focus, etc); // TODO: should also handle commands that are not in this map (insertText, focus, etc);

View File

@ -15,7 +15,7 @@ import useDropHandler from './utils/useDropHandler';
import useMarkupToHtml from './utils/useMarkupToHtml'; import useMarkupToHtml from './utils/useMarkupToHtml';
import useFormNote, { OnLoadEvent } from './utils/useFormNote'; import useFormNote, { OnLoadEvent } from './utils/useFormNote';
import styles_ from './styles'; import styles_ from './styles';
import { NoteTextProps, FormNote, ScrollOptions, ScrollOptionTypes, OnChangeEvent, NoteBodyEditorProps } from './utils/types'; import { NoteEditorProps, FormNote, ScrollOptions, ScrollOptionTypes, OnChangeEvent, NoteBodyEditorProps } from './utils/types';
import { attachResources } from './utils/resourceHandling'; import { attachResources } from './utils/resourceHandling';
const { themeStyle } = require('../../theme.js'); const { themeStyle } = require('../../theme.js');
@ -33,7 +33,7 @@ const eventManager = require('../../eventManager');
const NoteRevisionViewer = require('../NoteRevisionViewer.min'); const NoteRevisionViewer = require('../NoteRevisionViewer.min');
const TagList = require('../TagList.min.js'); const TagList = require('../TagList.min.js');
function NoteEditor(props: NoteTextProps) { function NoteEditor(props: NoteEditorProps) {
const theme = themeStyle(props.theme); const theme = themeStyle(props.theme);
const [showRevisions, setShowRevisions] = useState(false); const [showRevisions, setShowRevisions] = useState(false);

View File

@ -1,8 +1,8 @@
import { NoteTextProps } from '../utils/types'; import { NoteEditorProps } from '../utils/types';
const { buildStyle } = require('../../../theme.js'); const { buildStyle } = require('../../../theme.js');
export default function styles(props: NoteTextProps) { export default function styles(props: NoteEditorProps) {
return buildStyle('NoteEditor', props.theme, (theme: any) => { return buildStyle('NoteEditor', props.theme, (theme: any) => {
return { return {
root: { root: {

View File

@ -1,7 +1,7 @@
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
import AsyncActionQueue from '../../../lib/AsyncActionQueue'; import AsyncActionQueue from '../../../lib/AsyncActionQueue';
export interface NoteTextProps { export interface NoteEditorProps {
style: any; style: any;
noteId: string; noteId: string;
theme: number; theme: number;