mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Added placeholder remover on post history
no issue - removes the div containing the initial "Begin writing your post" from being part of the compared by the differ
This commit is contained in:
parent
f9e3813b08
commit
66e8d2a51e
@ -78,10 +78,13 @@ export default ModalComponent.extend({
|
||||
registerComparisonEditorApi(api) {
|
||||
this.comparisonEditor = api;
|
||||
}
|
||||
},
|
||||
|
||||
// toggleDifferences() {
|
||||
// this.toggleProperty('showDifferences');
|
||||
// }
|
||||
stripInitialPlaceholder(html) {
|
||||
//TODO: we should probably add a data attribute to Koenig and grab that instead
|
||||
const regex = /<div\b[^>]*>(\s*Begin writing your post\.\.\.\s*)<\/div>/i;
|
||||
const strippedHtml = html.replace(regex, '');
|
||||
return strippedHtml;
|
||||
},
|
||||
|
||||
toggleDifferences: action(function () {
|
||||
@ -151,8 +154,8 @@ export default ModalComponent.extend({
|
||||
|
||||
let updateIfBothDone = () => {
|
||||
if (previousDone && currentDone) {
|
||||
this.set('diffHtml', this.calculateHTMLDiff(previous.innerHTML, current.innerHTML));
|
||||
this.set('selectedHTML', current.innerHTML);
|
||||
this.set('diffHtml', this.calculateHTMLDiff(this.stripInitialPlaceholder(previous.innerHTML), this.stripInitialPlaceholder(current.innerHTML)));
|
||||
this.set('selectedHTML', this.stripInitialPlaceholder(current.innerHTML));
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user