OSDN Git Service

editor: article editor supports media embed
[newslash/newslash.git] / src / newslash_web / public / js / article-editor.js
index 7cab43e..aafb7a0 100644 (file)
@@ -30,6 +30,10 @@ articleEditor.init = function init () {
         id: 0,
        source_id: 0,
        source_type: 0,
+
+       mediaurl: "",
+       mediatype: "",
+       media: "",
       },
 
       message: "",
@@ -82,6 +86,9 @@ articleEditor.init = function init () {
     'editor.dept': function watchDept(val, oldVal) {
       this.item.dept = val;
     },
+    'editor.media': function watchMedia(val, oldVal) {
+      this.item.media = val;
+    },
     'editor.tags_string': _updateTopics,
   };
 
@@ -110,6 +117,7 @@ articleEditor.init = function init () {
       this.item.intro_text = _quoteHtml(this.editor.intro_text);
       this.item.body_text = _quoteHtml(this.editor.body_text);
       this.item.title = _quoteTitle(this.editor.title);
+      this.item.media = _quoteTitle(this.editor.media);
     },
     startEdit: function startEdit() {
       _startEdit.call(this);
@@ -143,6 +151,8 @@ articleEditor.init = function init () {
           this.message = "";
           this.item.title = resp.item.title;
           this.item.intro_text = resp.item.intro_text;
+          this.item.body_text = resp.item.body_text;
+          this.item.media = resp.item.media;
           this.item.url = this.editor.url;
           this.item.primary_topic = resp.item.topic;
           this.updatePrimaryTopicIconURL();