From ebb489a55c79bfb18fccd37123b4c1dffbe992f5 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Thu, 16 Feb 2017 16:48:31 +0200 Subject: [PATCH] focus working/ overlay working/ toolbar --- .../SimpleEditor/ContainerEditor.js | 6 +++-- app/components/SimpleEditor/Editor.js | 26 ++++++++++++++----- app/components/SimpleEditor/SimpleEditor.jsx | 1 - app/components/SimpleEditor/SimpleEditor.scss | 5 +++- .../panes/TableOfContents/TableOfContents.js | 1 - 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/app/components/SimpleEditor/ContainerEditor.js b/app/components/SimpleEditor/ContainerEditor.js index f3f7c6d..81e3b66 100644 --- a/app/components/SimpleEditor/ContainerEditor.js +++ b/app/components/SimpleEditor/ContainerEditor.js @@ -41,7 +41,7 @@ class ContainerEditor extends SubstanceContainerEditor { super.didMount() if (this.isEmpty()) this.createText() - this.focus() // TODO notworking + this.el.focus() // TODO notworking // if (this.isReadOnlyMode()) { // const documentSession = this.getDocumentSession() @@ -165,12 +165,14 @@ class ContainerEditor extends SubstanceContainerEditor { newSel = tx.createSelection({ type: 'property', + containerId: 'body', + surfaceId: 'body', path: [ node.id, 'content' ], startOffset: 0, endOffset: 0 }) }.bind(this)) - + console.log(newSel) this.rerender() this.editorSession.setSelection(newSel) } diff --git a/app/components/SimpleEditor/Editor.js b/app/components/SimpleEditor/Editor.js index a4dd0d0..ff269a4 100644 --- a/app/components/SimpleEditor/Editor.js +++ b/app/components/SimpleEditor/Editor.js @@ -2,16 +2,12 @@ import { includes, some } from 'lodash' import { ProseEditor, - ProseEditorOverlayTools, - ScrollPane, - SplitPane, TOCProvider } from 'substance' import Comments from './panes/Comments/CommentBoxList' import CommentsProvider from './panes/Comments/CommentsProvider' import ContainerEditor from './ContainerEditor' -// import Overlay from './Overlay' // import Notes from './panes/Notes/Notes' // import NotesProvider from './panes/Notes/NotesProvider' import TableOfContents from './panes/TableOfContents/TableOfContents' @@ -24,10 +20,16 @@ class Editor extends ProseEditor { this.handleActions({ 'showComments': function () { this.toggleCommentsArea(true) }, 'hideComments': function () { this.toggleCommentsArea(false) }, - 'trackChangesUpdate': function () { this.updateTrackChange() } + 'trackChangesUpdate': function () { this.updateTrackChange() }, + 'domSelectionRendered': function () { this.domSelectionRendered() } }) } + domSelectionRendered () { + // TODO what to handle here???? + console.log('rendered') + } + updateTrackChange () { this.extendProps({ trackChanges: !this.props.trackChanges @@ -66,6 +68,12 @@ class Editor extends ProseEditor { var toolbar = this._renderToolbar($$) var editor = this._renderEditor($$) + let SplitPane = this.componentRegistry.get('split-pane') + let ScrollPane = this.componentRegistry.get('scroll-pane') + let Overlay = this.componentRegistry.get('overlay') + let ContextMenu = this.componentRegistry.get('context-menu') // new what does it do? + let Dropzones = this.componentRegistry.get('dropzones') // new what does it do? + // var footerNotes = $$(Notes) const footerNotes = $$('div') @@ -94,10 +102,14 @@ class Editor extends ProseEditor { ) var contentPanel = $$(ScrollPane, { + name: 'contentPanel', + // contextMenu: 'custom', scrollbarPosition: 'right', - overlay: ProseEditorOverlayTools }) - .append(editorWithComments) + .append(editorWithComments, + $$(Overlay), + $$(ContextMenu), + $$(Dropzones)) .attr('id', 'content-panel') .ref('contentPanel') diff --git a/app/components/SimpleEditor/SimpleEditor.jsx b/app/components/SimpleEditor/SimpleEditor.jsx index 145bfeb..aee6bba 100644 --- a/app/components/SimpleEditor/SimpleEditor.jsx +++ b/app/components/SimpleEditor/SimpleEditor.jsx @@ -73,7 +73,6 @@ export default class SimpleEditor extends React.Component { save (source, changes, callback) { const { onSave } = this.props const config = this.state.config - const exporter = new SimpleExporter(config) const convertedSource = exporter.exportDocument(source) diff --git a/app/components/SimpleEditor/SimpleEditor.scss b/app/components/SimpleEditor/SimpleEditor.scss index e47373c..2c431a7 100644 --- a/app/components/SimpleEditor/SimpleEditor.scss +++ b/app/components/SimpleEditor/SimpleEditor.scss @@ -64,12 +64,15 @@ $active-blue: #4a90e2; right: 0; top: 0; - .sc-toolbar { + .se-toolbar-wrapper .sc-toolbar { background-color: $primary; border: 1px solid $border; border-right: 0; + float: left; + max-width: 1920px; padding-left: 0; vertical-align: middle; + width: 100%; @-moz-document url-prefix() { .sc-tool-group > .sc-switch-text-type { margin: 0; diff --git a/app/components/SimpleEditor/panes/TableOfContents/TableOfContents.js b/app/components/SimpleEditor/panes/TableOfContents/TableOfContents.js index c20f34e..70e0733 100644 --- a/app/components/SimpleEditor/panes/TableOfContents/TableOfContents.js +++ b/app/components/SimpleEditor/panes/TableOfContents/TableOfContents.js @@ -15,7 +15,6 @@ class TableOfContents extends Toc { } render ($$) { - console.log('in renderrr') const provider = this.getProvider() const { book, fragment } = provider.config.props -- GitLab