mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-23 22:58:31 +08:00
Improved markdown mobile editor experience
- Updated styles of codemirror area to be a bit more forefull in taking up space. - Added a fullscreen toggle as a backup option. For #1675
This commit is contained in:
parent
e06f9f7fe3
commit
865e8d4ec5
1
resources/icons/fullscreen.svg
Normal file
1
resources/icons/fullscreen.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>
|
After Width: | Height: | Size: 156 B |
|
@ -76,6 +76,7 @@ class MarkdownEditor {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (action === 'insertDrawing') this.actionStartDrawing();
|
if (action === 'insertDrawing') this.actionStartDrawing();
|
||||||
|
if (action === 'fullscreen') this.actionFullScreen();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mobile section toggling
|
// Mobile section toggling
|
||||||
|
@ -480,6 +481,13 @@ class MarkdownEditor {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make the editor full screen
|
||||||
|
actionFullScreen() {
|
||||||
|
const alreadyFullscreen = this.elem.classList.contains('fullscreen');
|
||||||
|
this.elem.classList.toggle('fullscreen', !alreadyFullscreen);
|
||||||
|
document.body.classList.toggle('markdown-fullscreen', !alreadyFullscreen);
|
||||||
|
}
|
||||||
|
|
||||||
// Scroll to a specified text
|
// Scroll to a specified text
|
||||||
scrollToText(searchText) {
|
scrollToText(searchText) {
|
||||||
if (!searchText) {
|
if (!searchText) {
|
||||||
|
|
|
@ -38,6 +38,7 @@ return [
|
||||||
'reset' => 'Reset',
|
'reset' => 'Reset',
|
||||||
'remove' => 'Remove',
|
'remove' => 'Remove',
|
||||||
'add' => 'Add',
|
'add' => 'Add',
|
||||||
|
'fullscreen' => 'Fullscreen',
|
||||||
|
|
||||||
// Sort Options
|
// Sort Options
|
||||||
'sort_options' => 'Sort Options',
|
'sort_options' => 'Sort Options',
|
||||||
|
|
|
@ -403,6 +403,7 @@ span.CodeMirror-selectedtext { background: none; }
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -62,6 +62,13 @@
|
||||||
width: 50%;
|
width: 50%;
|
||||||
max-width: 50%;
|
max-width: 50%;
|
||||||
}
|
}
|
||||||
|
&.fullscreen {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@include smaller-than($m) {
|
@include smaller-than($m) {
|
||||||
|
@ -71,6 +78,7 @@
|
||||||
#markdown-editor .markdown-editor-wrap {
|
#markdown-editor .markdown-editor-wrap {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
#markdown-editor .editor-toolbar {
|
#markdown-editor .editor-toolbar {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -83,12 +91,15 @@
|
||||||
border-bottom: 1px solid #DDD;
|
border-bottom: 1px solid #DDD;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.markdown-editor-wrap:not(.active) .editor-toolbar + div, .markdown-editor-wrap:not(.active) .editor-toolbar .buttons {
|
.markdown-editor-wrap:not(.active) .editor-toolbar + div,
|
||||||
|
.markdown-editor-wrap:not(.active) .editor-toolbar .buttons,
|
||||||
|
.markdown-editor-wrap:not(.active) .markdown-display {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#markdown-editor .markdown-editor-wrap:not(.active) {
|
#markdown-editor .markdown-editor-wrap:not(.active) {
|
||||||
flex-grow: 0;
|
flex-grow: 0;
|
||||||
flex: none;
|
flex: none;
|
||||||
|
min-height: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
body.mce-fullscreen .page-editor .edit-area {
|
body.mce-fullscreen .page-editor .edit-area,
|
||||||
|
body.markdown-fullscreen .page-editor .edit-area {
|
||||||
z-index: 12;
|
z-index: 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body.mce-fullscreen, body.markdown-fullscreen {
|
||||||
|
.page-editor, .flex-fill {
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@include smaller-than($s) {
|
@include smaller-than($s) {
|
||||||
.page-edit-toolbar {
|
.page-edit-toolbar {
|
||||||
overflow-x: scroll;
|
overflow-x: scroll;
|
||||||
|
|
|
@ -9,17 +9,21 @@
|
||||||
<div class="float right buttons">
|
<div class="float right buttons">
|
||||||
@if(config('services.drawio'))
|
@if(config('services.drawio'))
|
||||||
<button class="text-button" type="button" data-action="insertDrawing">@icon('drawing'){{ trans('entities.pages_md_insert_drawing') }}</button>
|
<button class="text-button" type="button" data-action="insertDrawing">@icon('drawing'){{ trans('entities.pages_md_insert_drawing') }}</button>
|
||||||
| 
|
<span class="mx-xs text-muted">|</span>
|
||||||
@endif
|
@endif
|
||||||
<button class="text-button" type="button" data-action="insertImage">@icon('image'){{ trans('entities.pages_md_insert_image') }}</button>
|
<button class="text-button" type="button" data-action="insertImage">@icon('image'){{ trans('entities.pages_md_insert_image') }}</button>
|
||||||
|
|
<span class="mx-xs text-muted">|</span>
|
||||||
<button class="text-button" type="button" data-action="insertLink">@icon('link'){{ trans('entities.pages_md_insert_link') }}</button>
|
<button class="text-button" type="button" data-action="insertLink">@icon('link'){{ trans('entities.pages_md_insert_link') }}</button>
|
||||||
|
<span class="mx-xs text-muted">|</span>
|
||||||
|
<button class="text-button" type="button" data-action="fullscreen">@icon('fullscreen'){{ trans('common.fullscreen') }}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div markdown-input class="flex flex-fill">
|
<div markdown-input class="flex flex-fill">
|
||||||
<textarea id="markdown-editor-input" name="markdown" rows="5"
|
<textarea id="markdown-editor-input"
|
||||||
@if($errors->has('markdown')) class="text-neg" @endif>@if(isset($model) || old('markdown')){{ old('markdown') ? old('markdown') : ($model->markdown === '' ? $model->html : $model->markdown) }}@endif</textarea>
|
@if($errors->has('markdown')) class="text-neg" @endif
|
||||||
|
name="markdown"
|
||||||
|
rows="5">@if(isset($model) || old('markdown')){{ old('markdown') ?? ($model->markdown === '' ? $model->html : $model->markdown) }}@endif</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user