Editor - Codeblock UI

This commit is contained in:
NGPixel 2016-12-03 20:20:06 -05:00
parent f7ba9ad143
commit f7ce81e8c9
8 changed files with 76 additions and 31 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -44,9 +44,20 @@ let vueCodeBlock = new Vue({
} }
}, },
methods: { methods: {
open: (ev) => {
$('#modal-editor-codeblock').addClass('is-active');
_.delay(() => {
codeEditor.resize();
codeEditor.focus();
codeEditor.setAutoScrollEditorIntoView(true);
codeEditor.renderer.updateFull();
}, 1000);
},
cancel: (ev) => { cancel: (ev) => {
mdeModalOpenState = false; mdeModalOpenState = false;
$('#modal-editor-codeblock').slideUp(); $('#modal-editor-codeblock').removeClass('is-active');
}, },
insertCode: (ev) => { insertCode: (ev) => {

View File

@ -27,12 +27,12 @@ let vueImage = new Vue({
open: () => { open: () => {
mdeModalOpenState = true; mdeModalOpenState = true;
$('#modal-editor-image').slideDown(); $('#modal-editor-image').addClass('is-active');
vueImage.refreshFolders(); vueImage.refreshFolders();
}, },
cancel: (ev) => { cancel: (ev) => {
mdeModalOpenState = false; mdeModalOpenState = false;
$('#modal-editor-image').slideUp(); $('#modal-editor-image').removeClass('is-active');
}, },
// ------------------------------------------- // -------------------------------------------

View File

@ -138,10 +138,7 @@ if($('#mk-editor').length === 1) {
codeEditor.setValue(''); codeEditor.setValue('');
} }
$('#modal-editor-codeblock').slideDown(400, () => { vueCodeBlock.open();
codeEditor.resize();
codeEditor.focus();
});
} }
}, },

View File

@ -102,6 +102,20 @@
overflow: auto; overflow: auto;
overflow-x: hidden; overflow-x: hidden;
> em {
display: flex;
align-items: center;
padding: 25px;
color: mc('grey', '500');
> i {
font-size: 32px;
margin-right: 10px;
color: mc('grey', '300');
}
}
> figure { > figure {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -235,12 +249,31 @@
position: relative; position: relative;
} }
.ace_scroller {
width: 100%;
}
.ace_content {
height: 100%;
}
#page-type-source .ace-container { #page-type-source .ace-container {
min-height: 95vh; min-height: 95vh;
} }
#modal-editor-codeblock .ace-container { #modal-editor-codeblock .ace-container {
height: 400px; display: flex;
align-items: stretch;
padding: 0;
position: relative;
width: 100%;
height: 100%;
#codeblock-editor {
width: 100%;
height: 100%;
min-height: 500px;
}
} }
#source-display, #codeblock-editor { #source-display, #codeblock-editor {

View File

@ -1,21 +1,23 @@
.modallayer#modal-editor-codeblock .modal#modal-editor-codeblock
.modallayer-content .modal-background
.modal-container
.modal-content.is-expanded
.columns header.is-green
.column span Insert Code Block
h3 Code Block
.column.is-narrow section.is-gapless
p.control .columns.is-stretched
span.select .column.is-one-quarter.modal-sidebar.is-green(style={'max-width':'350px'})
select(style={width: '300px'}, v-model='modeSelected') .model-sidebar-header Language
.model-sidebar-content
p.control.is-fullwidth
select(v-model='modeSelected')
option(v-for="mode in modes" v-bind:value='mode.name') {{ mode.caption }} option(v-for="mode in modes" v-bind:value='mode.name') {{ mode.caption }}
.column.is-narrow .column.ace-container
.control.is-grouped
p.control
a.button.is-warning.is-outlined(v-on:click="cancel") Cancel
p.control
a.button.is-primary.is-outlined(v-on:click="insertCode") Insert Code Block
.ace-container(style={'border-radius':'5px'})
#codeblock-editor #codeblock-editor
footer
a.button.is-grey.is-outlined(v-on:click="cancel") Discard
a.button.is-green(v-on:click="insertCode") Insert Code Block

View File

@ -29,7 +29,7 @@
li(v-for="fld in folders") li(v-for="fld in folders")
a(v-on:click="selectFolder(fld)", v-bind:class="{ 'is-active': currentFolder === fld }") a(v-on:click="selectFolder(fld)", v-bind:class="{ 'is-active': currentFolder === fld }")
i.icon-folder2 i.icon-folder2
span /{{ fld }} span / {{ fld }}
.model-sidebar-header Alignment .model-sidebar-header Alignment
.model-sidebar-content .model-sidebar-content
p.control.is-fullwidth p.control.is-fullwidth
@ -43,7 +43,9 @@
img(v-bind:src="'/uploads/t/' + img._id + '.png'") img(v-bind:src="'/uploads/t/' + img._id + '.png'")
span: strong {{ img.basename }} span: strong {{ img.basename }}
span {{ img.filesize | filesize }} span {{ img.filesize | filesize }}
em(v-show="images.length < 1") This folder is empty. em(v-show="images.length < 1")
i.icon-marquee-minus
| This folder is empty.
footer footer
a.button.is-grey.is-outlined(v-on:click="cancel") Discard a.button.is-grey.is-outlined(v-on:click="cancel") Discard
a.button.is-green(v-on:click="insertImage") Insert Image a.button.is-green(v-on:click="insertImage") Insert Image