bigkucha / yii2-ueditor-widget Goto Github PK
View Code? Open in Web Editor NEWUEditor for Yii2
UEditor for Yii2
有什么思路么
我在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
是 AssetBundle
类,默认情况下,当发布资源包时,所有在 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安装有问题。我修改之后可以使用了。但是就出现了上述问题。
求指教。
不好意思,步骤搞错了。
视频上传成功以后,点击查看源码,视频url丢失
目前控制台,会输出“请求后台配置项http错误,上传功能将不能正常使用!”这个错误。
如何加入KityFormula公式插件
/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了
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();
}
选中一段文字之后先后点B I U之后,首先U没有显示选中状态,其次再次点击U并不能取消下划线
RT,使用https协议访问网站,在网站百度编辑器内使用单图或多图上传的功能图片无法成功上传。切换回http协议后才可以上传。。
Invalid Configuration – yii\base\InvalidConfigException
Either 'name', or 'model' and 'attribute' properties must be specified.
如题,我上传的资源都要放到OSS中,访问路径也是,请问能不能自定义上传的处理功能?
解决办法
在配置中的whitList对象中添加如下配置
iframe:["frameborder","border","marginwidth","marginheight","width","height","src","id"],
不方便做扩展
可否增加在局域网,无法访问外网的时候也可以显示表情图片功能。谢谢。
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]);
}
}
应该是1.2.1吧,不知为啥写成1.21了,我不太敢用标示,怕升级有兼容问题,只敢写成1.2.,这样一来,就升级不上去了呢。
官网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'
],
]
]
]);?>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.