Coder Social home page Coder Social logo

yii2-ueditor-widget's Issues

不能进行设置是什么问题

我在yii2.0普通版中通过composer加载了插件,但是为什么我就是不能进行设置
'clientOptions' => [ //编辑区域大小 'initialFrameHeight' => '200', //设置语言 'lang' =>'en', //中文为 zh-cn //定制菜单 'toolbars' => [ [ 'fullscreen', 'source', 'undo', 'redo', '|', 'fontsize', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', '|', 'lineheight', '|', 'indent', '|' ], ]
这段代码没有起作用,请问下是什么原因

UEditorAsset.php 将暴露 assets/php/ 内的文件

UEditorAssetAssetBundle 类,默认情况下,当发布资源包时,所有在 yii\web\AssetBundle::$sourcePath 目录里的内容都会发布。所以当前的写法将会把 assets/php/ 内的 .php 文件也一并发布到 @webroot/assets 里;加上关闭了 CSRF 校验,就很容易遭到攻击。

应该删除不需要发布的文件;或者在UEditorAsset.php 添加以下代码,以白名单的方式发布资源文件:

public $publishOptions = [
    'only' => [
        '*.js',
        '*.css',
        '*.gif',
        '*.png',
        '*.jpg',
        '*.html',
        '*.swf',
    ]
];

参考官方文档: Yii 2.0 权威指南-资源-资源选项

照着你说的做的,出问题了

   Missing required parameter "id" when instantiating "kucha\ueditor\UEditorAction".

我之前加入了百度的echarts了,手动加入的。教程见这里

采用composer安装你的这个插件的时候,提示echarts安装有问题。我修改之后可以使用了。但是就出现了上述问题。
求指教。

不好意思,步骤搞错了。

抓取远程图片问题

/kucha/ueditor/Uploader.php 这个文件的182行

//获取请求头并检测死链
        $heads = get_headers($imgUrl, 1);
        if (!(stristr($heads[0], "200") && stristr($heads[0], "OK"))) {
            $this->stateInfo = $this->getStateInfo("ERROR_DEAD_LINK");
            return;
        }
        //格式验证(扩展名验证和Content-Type验证)
        $fileType = strtolower(strrchr($imgUrl, '.'));
        if (!in_array($fileType, $this->config['allowFiles']) || stristr($heads['Content-Type'], "image")) {
            $this->stateInfo = $this->getStateInfo("ERROR_HTTP_CONTENTTYPE");
            return;
        }

我现在是抓取有道笔记的图片,那个链接是https://note.youdao.com/yws/public/resource/1e8d9f637755152487451e129cef6cd9/xmlnote/WEBRESOURCE7173c64d1e084a6607534e92e11684bd/82 这种,没有后缀,所有获取是扩展名是com/yws/public/resource/1e8d9f637755152487451e129cef6cd9/xmlnote/WEBRESOURCE7173c64d1e084a6607534e92e11684bd/82是这个,第一个判断肯定不通过,第二个用get_header返回的content-type是image/png,
但在stristr($heads['Content-Type'], "image")这里就返回false了

在使用小部件的时候报InvalidConfigException异常

Invalid Configuration – yii\base\InvalidConfigException

Either 'name', or 'model' and 'attribute' properties must be specified.

查看源码后发现异常信息从这里抛出

public function init()
    {
        if ($this->name === null && !$this->hasModel()) {
            throw new InvalidConfigException("Either 'name', or 'model' and 'attribute' properties must be specified.");
        }
        if (!isset($this->options['id'])) {
            $this->options['id'] = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId();
        }
        parent::init();
    }

工具栏U(下划线bug)

选中一段文字之后先后点B I U之后,首先U没有显示选中状态,其次再次点击U并不能取消下划线

上传图片问题路径问题

不支持alias

我在配置里设置为@frontend/images/的时候,无法创建合适的文件夹。直接识别为@frontend。设想如果在部署网站的时候,网站的根地址改变,开发中涉及该地址的都需要修改地址了。

我提交了一个request,这样可以加入@webroot或者其他别名来统一管理地址。

UEditor.php 52行 第一个参数为 $this->name

public function run()
{
$this->registerClientScript();
if ($this->hasModel()) {
return Html::activeTextarea($this->model, $this->attribute, ['id' => $this->id]);
} else {
return Html::textarea($this->id, $this->value, ['id' => $this->id]);
}
}

composer最新版的版本号错了

应该是1.2.1吧,不知为啥写成1.21了,我不太敢用标示,怕升级有兼容问题,只敢写成1.2.,这样一来,就升级不上去了呢。

如何做到官网demo中,复制内容不保留样式

官网demo中,http://ueditor.baidu.com/website/onlinedemo.html,复制一段代码

<img p_id="3.jpg" src="http://www.ityimai.com/upload/ue/model/20170601/1496299971572417.jpg" style="margin: 0px 0px 0px -960px; padding: 0px; border: none; display: block; position: relative; left: 1268.67px; width: 983px; height: 428px; outline: 0px !important; -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;" width="983" height="428" border="0" vspace="0" title="" alt=""/>

后会自动变为

<img src="http://www.ityimai.com/upload/ue/model/20170601/1496299971572417.jpg" width="983" height="428" title="" alt=""/>

请问是怎么做到的?需要做哪些配置?

同时怎么把这些配置嵌入到yii2中的代码中,我得配置代码是

echo $form->field($model,'description')->widget('kucha\ueditor\UEditor',[
'clientOptions' => [
'toolbars' => [
[
'fullscreen', 'source', 'undo', 'redo', '|',
'fontsize',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|',
'forecolor', 'backcolor', '|',
'lineheight', '|',
'indent', '|',
'justifyleft', //居左对齐
'justifyright', //居右对齐
'justifycenter', '|',//居中对齐
'simpleupload', 'insertimage', 'insertvideo'
],
]
]
]);?>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.