zoukankan      html  css  js  c++  java
  • 在openerp撰写消息中增加图片

    openerp的撰写消息中, 在文本输入框中, 具有设置文本字体,设置对齐方式 等多种功能, 就像像写这篇新浪blog一样, 可以输入富文本信息。 美中不足的是, 它不能插入图片。 
    
    我们如何才能让openerp在撰写消息时插入图片呢?方法很简单。 因为openerp使用的富文本编辑器是cleditor。 cleditor的工具条已经具备了插入图片的功能, 只要在初始化时设置上就行。
    
    在openerp中, 初始化cleditor的代码在 addonswebstaticsrcjsview_form.js 文件中, 大约在2700行附近:
    
    
     initialize_content: function() {
    
       ......
    
           this.$textarea.cleditor({
    
               width, // width not including margins, borders or padding 
    
              height: height, // height not including margins, borders or padding
    
              controls: // controls to add to the toolbar
    
                     "bold italic underline strikethrough " +
    
                     "| removeformat | bullets numbering | outdent " +
    
                     "indent | link unlink | source",
    
    
    我们只需在source前面加上 image 就行了。如下所示:
    
    
     initialize_content: function() {
    
       ......
    
           this.$textarea.cleditor({
    
               width, // width not including margins, borders or padding 
    
              height: height, // height not including margins, borders or padding
    
              controls: // controls to add to the toolbar
    
                     "bold italic underline strikethrough " +
    
                     "| removeformat | bullets numbering | outdent " +
    
                     "indent | link unlink |  image source",
    
    
    如下这个例子在文本编辑器的工具栏上 显示了更多的按钮:
    
    
    controls:     // controls to add to the toolbar
              "bold italic underline strikethrough subscript superscript | font size " +
              "style | color highlight removeformat | bullets numbering | outdent " +
              "indent | alignleft center alignright justify | undo redo | " +
              "rule image link unlink | cut copy paste pastetext | print source",
  • 相关阅读:
    内网渗透笔记
    shift粘滞键后门创建/复原批处理
    通过Wireshark抓包进行Cookie劫持
    最全前端资源汇集 (持续整理中)
    HTML5教程之html 5 本地数据库(Web Sql Database)
    myslq 基本命令
    Node.js面试题:侧重后端应用与对Node核心的理解
    44个 Javascript 变态题解析 (上下)
    BAT及各大互联网公司前端笔试面试题--Html,Css篇
    Web前端面试题集锦
  • 原文地址:https://www.cnblogs.com/chjbbs/p/3503776.html
Copyright © 2011-2022 走看看