found a fixed weird text editor bug

This commit is contained in:
Ro 2019-02-23 20:52:16 -05:00
parent fb7e55369b
commit 59c46f64e2
6 changed files with 17 additions and 32 deletions

View file

@ -43,7 +43,8 @@ class TextEditor extends EventEmitter
} }
}); });
this.refresh(); this.refresh();
window.scroll(0,0); //window.scroll(0,0);
//document.execCommand('insertBrOnReturn', false, true);
} }
//-------------------------- //--------------------------
// methods // methods
@ -58,19 +59,7 @@ class TextEditor extends EventEmitter
} }
this.textEditor.addEventListener('input', f => this.textEditor.addEventListener('input', f =>
{ {
if (f.inputType == "insertParagraph") self.refresh();
{
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()
}
}) })
} }
refresh() refresh()

View file

@ -2224,6 +2224,7 @@ select {
font-size: 1.5em; font-size: 1.5em;
color: #f2f1ef; color: #f2f1ef;
padding: 5px; padding: 5px;
margin: 0 0 5px 0;
} }
#post-edit-index #post-edit-index-wrapper #post-header #post-title #post-date { #post-edit-index #post-edit-index-wrapper #post-header #post-title #post-date {
background: #32414e; background: #32414e;
@ -2287,6 +2288,7 @@ select {
height: 140px; height: 140px;
color: #b2cce5; color: #b2cce5;
padding: 5px; padding: 5px;
margin: 0 0 5px 0;
} }
#post-edit-index #post-edit-index-wrapper #post-header #post-meta #featured-image-upload, #post-edit-index #post-edit-index-wrapper #post-header #post-meta #featured-image-upload,
#post-edit-index #post-edit-index-wrapper #post-header #post-meta #post-image-upload { #post-edit-index #post-edit-index-wrapper #post-header #post-meta #post-image-upload {
@ -2338,6 +2340,7 @@ select {
background: #32414e; background: #32414e;
} }
#post-edit-index #post-edit-index-wrapper #edit-post #edit-post-wrapper pre code { #post-edit-index #post-edit-index-wrapper #edit-post #edit-post-wrapper pre code {
font-family: 'Apercu-Mono';
padding: 5px; padding: 5px;
border-radius: 5px; border-radius: 5px;
line-height: 1.6em; line-height: 1.6em;

File diff suppressed because one or more lines are too long

View file

@ -7830,9 +7830,10 @@ function (_EventEmitter) {
} }
}); });
_this.refresh(); _this.refresh(); //window.scroll(0,0);
//document.execCommand('insertBrOnReturn', false, true);
window.scroll(0, 0);
return _this; return _this;
} //-------------------------- } //--------------------------
// methods // methods
@ -7854,16 +7855,7 @@ function (_EventEmitter) {
} }
this.textEditor.addEventListener('input', function (f) { this.textEditor.addEventListener('input', function (f) {
if (f.inputType == "insertParagraph") { self.refresh();
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();
}
}); });
} }
}, { }, {
@ -9075,7 +9067,7 @@ var parent = module.bundle.parent;
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') { if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
var hostname = "" || location.hostname; var hostname = "" || location.hostname;
var protocol = location.protocol === 'https:' ? 'wss' : 'ws'; var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
var ws = new WebSocket(protocol + '://' + hostname + ':' + "49367" + '/'); var ws = new WebSocket(protocol + '://' + hostname + ':' + "61094" + '/');
ws.onmessage = function (event) { ws.onmessage = function (event) {
var data = JSON.parse(event.data); var data = JSON.parse(event.data);

File diff suppressed because one or more lines are too long

View file

@ -76,7 +76,7 @@
font-size 1.5em font-size 1.5em
color $white color $white
padding 5px padding 5px
margin 0 0 5px 0
#post-date #post-date
background $primary - 10% background $primary - 10%
border-radius 0 3px 3px 0 border-radius 0 3px 3px 0
@ -143,6 +143,7 @@
height 140px height 140px
color $secondary color $secondary
padding 5px padding 5px
margin 0 0 5px 0
#featured-image-upload, #post-image-upload #featured-image-upload, #post-image-upload
display none display none
@ -194,7 +195,7 @@
pre pre
code code
// font-family 'Apercu-Mono' font-family 'Apercu-Mono'
padding 5px padding 5px
border-radius 5px border-radius 5px
line-height 1.6em line-height 1.6em
@ -207,7 +208,7 @@
-o-line-break normal -o-line-break normal
-moz-line-break normal -moz-line-break normal
display inline-block display inline-block
overflow-wrap break-word overflow-wrap: break-word
width 100% width 100%
max-width 900px max-width 900px