OSDN Git Service

editor: article editor supports media embed
authorhylom <hylom@users.osdn.me>
Mon, 17 Jun 2019 08:58:24 +0000 (08:58 +0000)
committerhylom <hylom@users.osdn.me>
Mon, 17 Jun 2019 08:58:24 +0000 (08:58 +0000)
src/newslash_web/lib/Newslash/Web/Controller/API/Story.pm
src/newslash_web/public/js/article-editor.js
src/newslash_web/templates/common/article/editor.html.tt2

index 7f68440..5ad6cc5 100644 (file)
@@ -181,6 +181,11 @@ sub post {
     # TODO: media related
     #$item->{mediaurl};
     #$item->{mediatype};
+    #$item->{media};
+
+    if ($item->{media}) {
+       $params->{media} = $item->{media};
+    }
 
     # source
     if ($item->{source_id}) {
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();
index ed4b2f9..6bb813e 100644 (file)
       </label>
     </p>
 
+    <p v-if="contentType == 'story'">
+      <label>メディア:
+        <textarea name="media" v-model="editor.media"
+                  placeholder="埋め込みコンテンツなどをここに記述してください" ></textarea>
+      </label>
+    </p>
+
     <p v-if="contentType == 'submission'">
       <label>URL(本文がない場合は必須):
         <input type="text" name="url" v-model="editor.url" placeholder="重要なURLを1つ(任意)" />