Browse Source

support insert image

Artal Druk 8 years ago
parent
commit
a855d99cab
3 changed files with 9 additions and 0 deletions
  1. 4
    0
      src/RichTextEditor.js
  2. 4
    0
      src/WebviewMessageHandler.js
  3. 1
    0
      src/const.js

+ 4
- 0
src/RichTextEditor.js View File

179
     this._sendAction(actions.insertLink, {url, title});
179
     this._sendAction(actions.insertLink, {url, title});
180
   }
180
   }
181
 
181
 
182
+  insertImage(url, alt) {
183
+    this._sendAction(actions.insertImage, {url, alt});
184
+  }
185
+
182
   setSubscript() {
186
   setSubscript() {
183
     this._sendAction(actions.setSubscript);
187
     this._sendAction(actions.setSubscript);
184
   }
188
   }

+ 4
- 0
src/WebviewMessageHandler.js View File

72
           zss_editor.prepareInsert();
72
           zss_editor.prepareInsert();
73
           zss_editor.insertLink(action.data.url, action.data.title);
73
           zss_editor.insertLink(action.data.url, action.data.title);
74
           break;
74
           break;
75
+        case '${actions.insertImage}':
76
+          zss_editor.prepareInsert();
77
+          zss_editor.insertImage(action.data.url, action.data.alt);
78
+          break;
75
         case '${actions.setSubscript}':
79
         case '${actions.setSubscript}':
76
           zss_editor.setSubscript();
80
           zss_editor.setSubscript();
77
           break;
81
           break;

+ 1
- 0
src/const.js View File

23
   insertBulletsList: 'INST_BULLETS',
23
   insertBulletsList: 'INST_BULLETS',
24
   insertOrderedList: 'INST_ORDERED',
24
   insertOrderedList: 'INST_ORDERED',
25
   insertLink: 'INST_LINK',
25
   insertLink: 'INST_LINK',
26
+  insertImage: 'INST_IMAGE',
26
   setSubscript: 'SET_SUB',
27
   setSubscript: 'SET_SUB',
27
   setSuperscript: 'SET_SUPER',
28
   setSuperscript: 'SET_SUPER',
28
   setStrikethrough: 'SET_STRIKETHRU',
29
   setStrikethrough: 'SET_STRIKETHRU',