From 313c5c3db16e44a15a7e36052ac72605f2d21e99 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Tue, 4 Apr 2017 17:42:17 +0300 Subject: [PATCH] notes editor scroll pane minHeight is adjusted on height of dragged area + attempt to import commentsPane(fragment comments missing) --- .../SimpleEditor/miniEditor/miniEditor.js | 38 ++++++++++++++++++- .../SimpleEditor/miniEditor/miniEditor.scss | 2 +- .../SimpleEditor/panes/Notes/Notes.js | 5 ++- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/app/components/SimpleEditor/miniEditor/miniEditor.js b/app/components/SimpleEditor/miniEditor/miniEditor.js index 850fdbf..17c7961 100644 --- a/app/components/SimpleEditor/miniEditor/miniEditor.js +++ b/app/components/SimpleEditor/miniEditor/miniEditor.js @@ -4,6 +4,8 @@ import { } from 'substance' import ContainerEditor from '../ContainerEditor' +import Comments from '../panes/Comments/CommentBoxList' +import CommentsProvider from '../panes/Comments/CommentsProvider' class MiniEditor extends ProseEditor { render ($$) { @@ -15,7 +17,15 @@ class MiniEditor extends ProseEditor { let Overlay = this.componentRegistry.get('overlay') // TEMP - const commentsPane = $$('ul').addClass('sc-comment-pane-list').addClass('sc-comments-pane').append('notes Editor Comments') + // const commentsPane = $$('ul').addClass('sc-comment-pane-list').addClass('sc-comments-pane').append('notes Editor Comments') + console.log($$(Comments)) + var commentsPane = $$(Comments, { + // TODO -- should probably remove the || {} + // comments: this.props.fragment.comments || {}, + fragment: this.props.fragment, + update: this.props.update, + user: this.props.user + }).addClass('sc-comments-pane') const editorWithComments = $$(SplitPane, { sizeA: '100%', splitType: 'vertical' }) .append( @@ -28,7 +38,7 @@ class MiniEditor extends ProseEditor { scrollbarPosition: 'right' }) .append(editorWithComments, $$(Overlay)) - .attr('id', 'content-panel') + .attr('id', 'mini-editor-content-panel') .ref('miniEditorContentPanel') el.append( @@ -56,6 +66,30 @@ class MiniEditor extends ProseEditor { spellcheck: 'native' }).ref('mini_body') } + + getChildContext () { + const oldContext = super.getChildContext() + const doc = this.doc + + // comments provider + const commentsProvider = new CommentsProvider(doc, { + commandManager: this.commandManager, + // comments: this.props.fragment.comments, + containerId: this.props.containerId, + controller: this, + editorSession: this.editorSession, + fragment: this.props.fragment, + surfaceManager: this.surfaceManager, + toggleCommentsArea: this.toggleCommentsArea, + update: this.props.update + }) + + // attach all to context + return { + ...oldContext, + commentsProvider + } + } } export default MiniEditor diff --git a/app/components/SimpleEditor/miniEditor/miniEditor.scss b/app/components/SimpleEditor/miniEditor/miniEditor.scss index 9c1c8aa..f57ca7c 100644 --- a/app/components/SimpleEditor/miniEditor/miniEditor.scss +++ b/app/components/SimpleEditor/miniEditor/miniEditor.scss @@ -14,7 +14,7 @@ $background: #fff; .se-scrollable { margin-top: 0; - min-height: 700px; + min-height: 95px; background: $background; .se-content { diff --git a/app/components/SimpleEditor/panes/Notes/Notes.js b/app/components/SimpleEditor/panes/Notes/Notes.js index c2d55e3..f918405 100644 --- a/app/components/SimpleEditor/panes/Notes/Notes.js +++ b/app/components/SimpleEditor/panes/Notes/Notes.js @@ -23,7 +23,10 @@ class Notes extends Component { } resize (e) { - this.el.el.style.height = (this.el.el.offsetHeight + this.el.el.offsetTop - e.clientY) + 'px' + const height = (this.el.el.offsetHeight + this.el.el.offsetTop - e.clientY) + const scrollPane = document.getElementsByClassName('se-scrollable') + scrollPane[1].style.minHeight = height - 40 + 'px' + this.el.el.style.height = height + 'px' } stopResize (e) { -- GitLab