mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
🐛 Fixed captions becoming uneditable when they have a trailing space
closes https://github.com/TryGhost/Team/issues/1023 closes https://github.com/TryGhost/Ghost/issues/11424 - we were comparing the caption editor's contenteditable inner html vs the passed in html in order to reset the editor if the bound value changed upstream, this was causing problems because the editor and external html cleaning were treating trailing whitespace slightly differently which resulted in the editor being reset every time it gained focus when a trailing space was present - removed reliance on inspecting the editor's inner html and instead switched to comparing a changed `html` value to that which was passed in during initialisation or was last passed upstream from the editor so there's no chance of unexpected deviance
This commit is contained in:
parent
bc48cdffd0
commit
5eb817373f
@ -74,6 +74,7 @@ export default Component.extend({
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.SPECIAL_MARKUPS = [];
|
||||
this._lastSetHtml = this.html;
|
||||
},
|
||||
|
||||
didReceiveAttrs() {
|
||||
@ -81,8 +82,9 @@ export default Component.extend({
|
||||
|
||||
// reset local mobiledoc if html has been changed upstream so that
|
||||
// the html will be re-parsed by the mobiledoc-kit editor
|
||||
if (this.cleanHTML !== this._getHTML()) {
|
||||
if (this._lastSetHtml !== this.html) {
|
||||
this.set('mobiledoc', null);
|
||||
this._lastSetHtml = this.html;
|
||||
}
|
||||
},
|
||||
|
||||
@ -343,7 +345,9 @@ export default Component.extend({
|
||||
|
||||
postDidChange() {
|
||||
// trigger closure action
|
||||
this.onChange(this._getHTML());
|
||||
const html = this._getHTML();
|
||||
this._lastSetHtml = html;
|
||||
this.onChange(html);
|
||||
},
|
||||
|
||||
cursorDidChange(editor) {
|
||||
|
Loading…
Reference in New Issue
Block a user