Removing the byline whenever a note is saved so it doesn't accidentally get written to the database.
This commit is contained in:
parent
c74a18ae1e
commit
78cac16bde
|
@ -456,7 +456,7 @@ Editor.prototype.position_cursor = function ( div_range ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise, just move the text cursor to the end of the text
|
// otherwise, just move the text cursor to the end of the text
|
||||||
if ( this.iframe.contentWindow && this.iframe.contentWindow.getSelection ) { // browsers such as Firefox
|
if ( this.iframe && this.iframe.contentWindow && this.iframe.contentWindow.getSelection ) { // browsers such as Firefox
|
||||||
var selection = this.iframe.contentWindow.getSelection();
|
var selection = this.iframe.contentWindow.getSelection();
|
||||||
var last_node = this.document.body.lastChild;
|
var last_node = this.document.body.lastChild;
|
||||||
|
|
||||||
|
|
|
@ -1080,6 +1080,16 @@ Wiki.prototype.make_byline = function ( username, creation, note_id ) {
|
||||||
' | <a href="' + window.location.pathname + '?note_id=' + note_id + '" target="_top">permalink</a>';
|
' | <a href="' + window.location.pathname + '?note_id=' + note_id + '" target="_top">permalink</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Wiki.prototype.remove_byline = function ( editor ) {
|
||||||
|
if ( editor.document && editor.read_write ) {
|
||||||
|
var byline = getFirstElementByTagAndClassName( "div", "byline", editor.document );
|
||||||
|
if ( byline ) {
|
||||||
|
removeElement( byline );
|
||||||
|
editor.resize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Wiki.prototype.editor_mouse_hovered = function ( editor, target ) {
|
Wiki.prototype.editor_mouse_hovered = function ( editor, target ) {
|
||||||
var pulldowns = getElementsByTagAndClassName( "div", "pulldown" );
|
var pulldowns = getElementsByTagAndClassName( "div", "pulldown" );
|
||||||
|
|
||||||
|
@ -1124,13 +1134,7 @@ Wiki.prototype.key_pressed = function ( event ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Wiki.prototype.editor_key_pressed = function ( editor, event ) {
|
Wiki.prototype.editor_key_pressed = function ( editor, event ) {
|
||||||
if ( editor.document && editor.read_write ) {
|
this.remove_byline( editor );
|
||||||
var byline = getFirstElementByTagAndClassName( "div", "byline", editor.document );
|
|
||||||
if ( byline ) {
|
|
||||||
removeElement( byline );
|
|
||||||
editor.resize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var code = event.key().code;
|
var code = event.key().code;
|
||||||
|
|
||||||
|
@ -1718,6 +1722,7 @@ Wiki.prototype.save_editor = function ( editor, fire_and_forget, callback, synch
|
||||||
if ( editor && editor.read_write && !editor.closed &&
|
if ( editor && editor.read_write && !editor.closed &&
|
||||||
( ( !editor.empty() && editor.dirty() ) || position_after || position_before ) ) {
|
( ( !editor.empty() && editor.dirty() ) || position_after || position_before ) ) {
|
||||||
editor.scrape_title();
|
editor.scrape_title();
|
||||||
|
this.remove_byline( editor );
|
||||||
|
|
||||||
this.invoker.invoke( "/notebooks/save_note", "POST", {
|
this.invoker.invoke( "/notebooks/save_note", "POST", {
|
||||||
"notebook_id": this.notebook.object_id,
|
"notebook_id": this.notebook.object_id,
|
||||||
|
|
Reference in New Issue