refactoring to editable_text

This commit is contained in:
zadam 2020-04-07 21:04:28 +02:00
parent d34d265d01
commit 3ccb1c6ac1
4 changed files with 10 additions and 6 deletions

View File

@ -56,7 +56,7 @@ import SimilarNotesWidget from "./widgets/similar_notes.js";
import WhatLinksHereWidget from "./widgets/what_links_here.js";
import SidePaneToggles from "./widgets/side_pane_toggles.js";
import EmptyTypeWidget from "./widgets/type_widgets/empty.js";
import TextTypeWidget from "./widgets/type_widgets/text.js";
import TextTypeWidget from "./widgets/type_widgets/editable_text.js";
import CodeTypeWidget from "./widgets/type_widgets/code.js";
import FileTypeWidget from "./widgets/type_widgets/file.js";
import ImageTypeWidget from "./widgets/type_widgets/image.js";

View File

@ -5,7 +5,7 @@ import noteContentRenderer from "./services/note_content_renderer.js";
import appContext from "./services/app_context.js";
import FlexContainer from "./widgets/flex_container.js";
import EmptyTypeWidget from "./widgets/type_widgets/empty.js";
import TextTypeWidget from "./widgets/type_widgets/text.js";
import TextTypeWidget from "./widgets/type_widgets/editable_text.js";
import CodeTypeWidget from "./widgets/type_widgets/code.js";
import FileTypeWidget from "./widgets/type_widgets/file.js";
import ImageTypeWidget from "./widgets/type_widgets/image.js";

View File

@ -5,7 +5,7 @@ import SpacedUpdate from "../services/spaced_update.js";
import server from "../services/server.js";
import libraryLoader from "../services/library_loader.js";
import EmptyTypeWidget from "./type_widgets/empty.js";
import TextTypeWidget from "./type_widgets/text.js";
import EditableTextTypeWidget from "./type_widgets/editable_text.js";
import CodeTypeWidget from "./type_widgets/code.js";
import FileTypeWidget from "./type_widgets/file.js";
import ImageTypeWidget from "./type_widgets/image.js";
@ -36,7 +36,7 @@ const TPL = `
const typeWidgetClasses = {
'empty': EmptyTypeWidget,
'deleted': DeletedTypeWidget,
'text': TextTypeWidget,
'editable-text': EditableTextTypeWidget,
'read-only-text': ReadOnlyTextTypeWidget,
'code': CodeTypeWidget,
'file': FileTypeWidget,
@ -187,6 +187,10 @@ export default class NoteDetailWidget extends TabAwareWidget {
}
}
if (type === 'text') {
type = 'editable-text';
}
if (note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable()) {
type = 'protected-session';
}

View File

@ -78,8 +78,8 @@ const TPL = `
</div>
`;
export default class TextTypeWidget extends TypeWidget {
static getType() { return "text"; }
export default class EditableTextTypeWidget extends TypeWidget {
static getType() { return "editable-text"; }
doRender() {
this.$widget = $(TPL);