From 103d8ef26df9ec6c86098eecbf16304f08248f7d Mon Sep 17 00:00:00 2001 From: Vinicius Reis Date: Tue, 11 Oct 2022 12:21:07 -0300 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=20(#2904):=20Able=20to=20show=20o?= =?UTF-8?q?utiline=20in=20readonly=20mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Vinicius Reis --- css/print.scss | 24 ++++- css/prosemirror.scss | 6 ++ cypress/e2e/share.spec.js | 8 ++ src/components/Editor.vue | 138 ++++++++++++++---------- src/components/Editor/EditorOutline.vue | 32 +++--- src/components/Menu/ActionSingle.vue | 2 +- src/components/Menu/BaseActionEntry.js | 5 +- src/components/Menu/ReadonlyBar.vue | 35 ++++++ src/components/Menu/entries.js | 15 +++ 9 files changed, 190 insertions(+), 75 deletions(-) create mode 100644 src/components/Menu/ReadonlyBar.vue diff --git a/css/print.scss b/css/print.scss index bca5c406af9..6897064406b 100644 --- a/css/print.scss +++ b/css/print.scss @@ -1,7 +1,7 @@ @media print { @page { size: A4; - margin: 2.5cm 2cm 2cm 2.5cm; + margin: 2.5cm 2cm 2cm 2.5cm; } body { @@ -81,4 +81,24 @@ } } } -} \ No newline at end of file + + .menubar-placeholder, .text-editor--readonly-bar { + display: none; + } + + .text-editor__content-wrapper { + &.--show-outline { + display: block; + } + + .editor--outline { + width: auto; + height: auto; + overflow: unset; + position: relative; + } + .editor--outline__btn-close { + display: none; + } + } +} diff --git a/css/prosemirror.scss b/css/prosemirror.scss index d44e982fc3c..ded47a81da6 100644 --- a/css/prosemirror.scss +++ b/css/prosemirror.scss @@ -88,6 +88,12 @@ div.ProseMirror { margin-top: 10px; } + > h1,h2,h3,h4,h5,h6 { + &:first-child { + margin-top: 0; + } + } + a { color: var(--color-primary-element); text-decoration: underline; diff --git a/cypress/e2e/share.spec.js b/cypress/e2e/share.spec.js index 9493f9f5683..66c44223621 100644 --- a/cypress/e2e/share.spec.js +++ b/cypress/e2e/share.spec.js @@ -55,6 +55,14 @@ describe('Open test.md in viewer', function() { cy.getContent() .should('contain', 'Hello world') .find('h2').should('contain', 'Hello world') + + cy.get('.text-editor--readonly-bar') + .getActionEntry('outline') + .click() + + cy.getOutline() + .find('header') + .should('exist') }) }) diff --git a/src/components/Editor.vue b/src/components/Editor.vue index 7b350898b4b..f849ee69290 100644 --- a/src/components/Editor.vue +++ b/src/components/Editor.vue @@ -34,19 +34,26 @@ :content-loaded="contentLoaded" :show-author-annotations="showAuthorAnnotations"> - - - - -