fixed html render on new post bug; fixed cursor not moving on return in text editor bug

This commit is contained in:
Ro 2018-11-09 15:51:54 -05:00
parent c2de21b9b1
commit e75b50d804
9 changed files with 62 additions and 42 deletions

View file

@ -2231,7 +2231,7 @@ select {
#entries-edit-index #entries-edit-index-wrapper #entry-header #entry-meta #entry_tags { #entries-edit-index #entries-edit-index-wrapper #entry-header #entry-meta #entry_tags {
background: #354554; background: #354554;
font-family: 'Apercu'; font-family: 'Apercu';
width: 100%; width: 97.6%;
height: 140px; height: 140px;
color: #b2cce5; color: #b2cce5;
padding: 5px; padding: 5px;
@ -2602,25 +2602,33 @@ select {
top: 1px; top: 1px;
border-radius: 3px; border-radius: 3px;
width: 100%; width: 100%;
max-width: 425px;
z-index: 2000; z-index: 2000;
} }
#edit-control button:nth-child(1) { #edit-control button:nth-child(1) {
border-radius: 3px 0 0 3px; border-radius: 3px 0 0 3px;
} }
#edit-control button:nth-child(10) {
border-radius: 0 3px 3px 0;
}
#edit-control button { #edit-control button {
background: #b2cce5;
width: 10%;
height: 35px;
-moz-transition: all 0.3s linear; -moz-transition: all 0.3s linear;
-webkit-transition: all 0.3s linear; -webkit-transition: all 0.3s linear;
-o-transition: all 0.3s linear; -o-transition: all 0.3s linear;
transition: all 0.3s linear; transition: all 0.3s linear;
margin: 0; margin: 0;
border-radius: 0; border-radius: 0;
display: inline-block;
vertical-align: top;
text-align: center;
} }
#edit-control button:hover { #edit-control button:hover {
background: #75a4d0; background: #75a4d0;
} }
#edit-control #option-update { #edit-control #option-update {
height: 35px;
width: 35px;
padding: 5px 5px 1px 5px; padding: 5px 5px 1px 5px;
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
@ -2634,7 +2642,7 @@ select {
background: #f2f1ef; background: #f2f1ef;
} }
#edit-control .submit-start svg { #edit-control .submit-start svg {
fill: #fc6399; fill: #32cd32;
} }
#edit-control .submit-cool { #edit-control .submit-cool {
background: #32cd32; background: #32cd32;
@ -2642,6 +2650,12 @@ select {
#edit-control .submit-cool svg { #edit-control .submit-cool svg {
fill: #f2f1ef; fill: #f2f1ef;
} }
#edit-control .submit-delete {
background: #ce483b !important;
}
#edit-control .submit-delete svg {
fill: #f2f1ef !important;
}
#edit-control #option-date { #edit-control #option-date {
height: 30px; height: 30px;
padding-top: 6px; padding-top: 6px;
@ -2653,29 +2667,15 @@ select {
fill: #f2f1ef; fill: #f2f1ef;
} }
#edit-control .content-editor-btn-icon { #edit-control .content-editor-btn-icon {
height: 35px;
width: 40px;
background: #b2cce5;
padding: 5px 5px 1px 5px; padding: 5px 5px 1px 5px;
color: #374857; color: #374857;
display: inline-block;
vertical-align: top;
text-align: center;
margin: 0;
} }
#edit-control .content-editor-btn-icon svg { #edit-control .content-editor-btn-icon svg {
fill: #374857; fill: #374857;
} }
#edit-control .content-editor-btn-text { #edit-control .content-editor-btn-text {
width: 40px;
height: 35px;
background: #b2cce5;
padding: 5px; padding: 5px;
color: #374857; color: #374857;
vertical-align: top;
display: inline-block;
text-align: center;
margin: 0;
} }
#edit-control #option-bold { #edit-control #option-bold {
font-weight: bold; font-weight: bold;

File diff suppressed because one or more lines are too long

View file

@ -1428,7 +1428,16 @@ function (_EventEmitter) {
} }
this.textEditor.addEventListener('input', function (f) { this.textEditor.addEventListener('input', function (f) {
self.refresh(); if (f.inputType == "insertParagraph") {
var caret = (0, _caretPos.position)(self.textEditor).pos + 1;
var spiffed = hljs.highlight('markdown', self.textEditor.innerText).value;
var temp = document.createElement("div");
temp.innerText = spiffed;
self.textEditor.innerHTML = temp.innerText;
(0, _caretPos.position)(self.textEditor, caret);
} else {
self.refresh();
}
}); });
} }
}, { }, {

File diff suppressed because one or more lines are too long

View file

@ -5,7 +5,7 @@ block main-content
h2 Entries h2 Entries
a.add-new-post(href="/@/dashboard/entries/add/new") a.add-new-post(href="/@/dashboard/entries/add/new")
svg#new-upload-link(viewBox="0 0 20 20" class="icons") svg#new-upload-link(viewBox="0 0 20 20" class="icons")
use(xlink:href='/dash/assets/images/sprite.svg#entypo-plus') use(xlink:href='/dash/assets/images/sprite.svg#entypo-new-message')
| NEW POST | NEW POST
#entries-list #entries-list
- var index = 0; - var index = 0;

View file

@ -26,7 +26,7 @@
use(xlink:href='/dash/assets/images/sprite.svg#entypo-thumbs-up') use(xlink:href='/dash/assets/images/sprite.svg#entypo-thumbs-up')
svg#submit-error.icon-hide(viewBox="0 0 20 20" class="icons") svg#submit-error.icon-hide(viewBox="0 0 20 20" class="icons")
use(xlink:href='/dash/assets/images/sprite.svg#entypo-thumbs-down') use(xlink:href='/dash/assets/images/sprite.svg#entypo-thumbs-down')
button#option-delete.content-editor-btn-icon.editor-button(for="post-delete" title='insert image') button#option-delete.content-editor-btn-icon.editor-button.submit-delete(for="post-delete" title='delete post')
svg#option-delete(viewBox="0 0 20 20" class="icons") svg#option-delete(viewBox="0 0 20 20" class="icons")
use#option-delete(xlink:href='/dash/assets/images/sprite.svg#entypo-cross') use#option-delete(xlink:href='/dash/assets/images/sprite.svg#entypo-cross')
else else

View file

@ -45,7 +45,17 @@ class TextEditor extends EventEmitter {
editorButtons[i].addEventListener('click', e => this.handleEditorOption(e), false); editorButtons[i].addEventListener('click', e => this.handleEditorOption(e), false);
} }
this.textEditor.addEventListener('input', f => { this.textEditor.addEventListener('input', f => {
self.refresh(); if(f.inputType == "insertParagraph")
{
var caret = position(self.textEditor).pos+1;
var spiffed = hljs.highlight('markdown', self.textEditor.innerText).value;
var temp = document.createElement("div");
temp.innerText = spiffed;
self.textEditor.innerHTML = temp.innerText;
position(self.textEditor, caret)
}else{
self.refresh()
}
}) })
} }

View file

@ -4,21 +4,28 @@
border-radius 3px border-radius 3px
// background-opacity($primary - 10%, 0.50) // background-opacity($primary - 10%, 0.50)
width 100% width 100%
max-width 425px
z-index 2000 z-index 2000
button:nth-child(1) button:nth-child(1)
border-radius 3px 0 0 3px border-radius 3px 0 0 3px
button:nth-child(10)
border-radius 0 3px 3px 0
button button
background $secondary
width 10%
height 35px
object-transitions(0.3s) object-transitions(0.3s)
margin 0 margin 0
border-radius 0 border-radius 0
display inline-block
vertical-align top
text-align center
button:hover button:hover
background: $secondary - 20% background: $secondary - 20%
#option-update #option-update
height 35px
width 35px
padding 5px 5px 1px 5px padding 5px 5px 1px 5px
display inline-block display inline-block
vertical-align top vertical-align top
@ -32,7 +39,7 @@
background $white background $white
svg svg
fill $highlight fill $eventCool
.submit-cool .submit-cool
background $eventCool background $eventCool
@ -40,6 +47,14 @@
svg svg
fill $white fill $white
.submit-delete
background $eventLame !important
svg
fill $white !important
#option-date #option-date
height 30px height 30px
padding-top 6px padding-top 6px
@ -51,31 +66,17 @@
fill $white fill $white
.content-editor-btn-icon .content-editor-btn-icon
height 35px
width 40px
background $secondary
padding 5px 5px 1px 5px padding 5px 5px 1px 5px
// border-radius 20px // border-radius 20px
color $primary color $primary
display inline-block
vertical-align top
text-align center
margin 0
svg svg
fill $primary fill $primary
.content-editor-btn-text .content-editor-btn-text
width 40px
height 35px
background $secondary
padding 5px padding 5px
// border-radius 20px // border-radius 20px
color $primary color $primary
vertical-align top
display inline-block
text-align center
margin 0
#option-bold #option-bold
font-weight bold font-weight bold

View file

@ -94,7 +94,7 @@
#entry_tags #entry_tags
background $primary - 4% background $primary - 4%
font-family 'Apercu' font-family 'Apercu'
width 100% width 97.6%
height 140px height 140px
color $secondary color $secondary
padding 5px padding 5px