Generate plain previews for plain text editor
This commit is contained in:
@@ -272,6 +272,15 @@ angular.module('app')
|
|||||||
// We don't want to update the client modified date if toggling lock for note.
|
// We don't want to update the client modified date if toggling lock for note.
|
||||||
note.setDirty(true, dontUpdateClientModified);
|
note.setDirty(true, dontUpdateClientModified);
|
||||||
|
|
||||||
|
|
||||||
|
let limit = 80;
|
||||||
|
var text = note.text || "";
|
||||||
|
var truncate = text.length > limit;
|
||||||
|
note.content.preview_plain = text.substring(0, limit) + (truncate ? "..." : "");
|
||||||
|
|
||||||
|
// Clear dynamic previews if using plain editor
|
||||||
|
note.content.preview_html = null;
|
||||||
|
|
||||||
syncManager.sync().then((response) => {
|
syncManager.sync().then((response) => {
|
||||||
if(response && response.error) {
|
if(response && response.error) {
|
||||||
if(!this.didShowErrorAlert) {
|
if(!this.didShowErrorAlert) {
|
||||||
@@ -346,11 +355,6 @@ angular.module('app')
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.contentChanged = function() {
|
this.contentChanged = function() {
|
||||||
|
|
||||||
// Clear dynamic previews if using plain editor
|
|
||||||
this.note.content.preview_html = null;
|
|
||||||
this.note.content.preview_plain = null;
|
|
||||||
|
|
||||||
// content changes should bypass manual debouncer as we use the built in ng-model-options debouncer
|
// content changes should bypass manual debouncer as we use the built in ng-model-options debouncer
|
||||||
this.changesMade({bypassDebouncer: true});
|
this.changesMade({bypassDebouncer: true});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
$line-height: 18px;
|
$line-height: 18px;
|
||||||
.default-preview {
|
.default-preview, .plain-preview {
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
-webkit-line-clamp: 1; /* number of lines to show */
|
-webkit-line-clamp: 1; /* number of lines to show */
|
||||||
@@ -146,11 +146,6 @@
|
|||||||
max-height: calc(#{$line-height} * 1); /* fallback */
|
max-height: calc(#{$line-height} * 1); /* fallback */
|
||||||
}
|
}
|
||||||
|
|
||||||
.plain-preview {
|
|
||||||
line-height: 19px;
|
|
||||||
margin-top: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.html-preview {
|
.html-preview {
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
|
|||||||
Reference in New Issue
Block a user