dever 6 年 前
コミット
321c762fe0
1 ファイル変更26 行追加1 行削除
  1. 26 1
      src/Lib/Input.php

+ 26 - 1
src/Lib/Input.php

@@ -300,7 +300,32 @@ class Input
      */
     public static function _editor($param)
     {
-        return '<textarea style="width:100%;display: inline"  update_type="value" class=" update_value editor" id="' . $param['name'] . '_editor" key="' . (isset($param['key']) ? $param['key'] : 1) . '" media="' . (isset($param['media']) ? $param['media'] : "") . '" name="' . $param['name'] . '" rows="18" cols="100" >' . (isset($param['value']) ? $param['value'] : (isset($param['default']) ? $param['default'] : '')) . '</textarea>';
+        $width = '100%';
+        $html = '';
+        if (isset($param['editor'])) {
+            $width = '70%';
+            $html .= '<div class="layui-col-lg6" style="display:inline;position: absolute;left: 740px;"><div><label style="font-size:14px;font-weight:bold;" class="">'.$param['editor']['name'].'</label></div><div>';
+
+            foreach ($param['editor']['button'] as $k => $v) {
+                if (isset($v['type'])) {
+                    $v['type'] = 'editor_tool" tool="' . $v['type'];
+
+                    if ($v['type'] == 'image') {
+                        $param['key'] = $v['key'];
+                    } elseif ($v['type'] == 'media') {
+                        $param['media'] = $v['key'];
+                    }
+                } else {
+                    $v['type'] = 'upload_show';
+                }
+
+
+                $html .= '<input type="button" style="width:100px;display:inline;padding-left:0px;margin:5px;" class="form-control layui-input '.$v['type'].'" editor_id="' . $param['name'] . '_editor" key="'.$v['key'].'" value="'.$v['name'].'">';
+            }
+
+            $html .= '</div></div>';
+        }
+        return $html . '<textarea style="'.$width.';display: inline"  update_type="value" class=" update_value editor" id="' . $param['name'] . '_editor" key="' . (isset($param['key']) ? $param['key'] : 1) . '" media="' . (isset($param['media']) ? $param['media'] : "") . '" name="' . $param['name'] . '" rows="18" cols="100" >' . (isset($param['value']) ? $param['value'] : (isset($param['default']) ? $param['default'] : '')) . '</textarea>';
     }
 
     /**