Skip to content

Commit

Permalink
适配CMS
Browse files Browse the repository at this point in the history
  • Loading branch information
deatil committed Jun 14, 2024
1 parent cdaa9b3 commit 1d3b501
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"laket" : {
"title": "百度编辑器",
"version": "1.2.2",
"version": "1.2.3",
"adaptation": "1.2.*"
},
"extra": {
Expand Down
19 changes: 14 additions & 5 deletions src/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ public function start()
protected function getInputItemJS($item)
{
$html = '
<script type="text/javascript" src="laket-ueditor/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="laket-ueditor/ueditor/ueditor.all.js"></script>
<script type="text/javascript" src="'.assets("laket-ueditor/ueditor/ueditor.config.js").'"></script>
<script type="text/javascript" src="'.assets("laket-ueditor/ueditor/ueditor.all.js").'"></script>
<script type="text/javascript">
var laket_ueditor = {
"upload_url": "'.laket_route("admin.laket-ueditor.upload").'?dir=images"
};
</script>
<script type="text/javascript" src="laket-ueditor/ueditor.js"></script>
<script type="text/javascript" src="'.assets("laket-ueditor/ueditor.js").'"></script>
';

return $html;
Expand Down Expand Up @@ -105,7 +105,7 @@ protected function getInputItem($item)
*/
protected function loadEvent()
{
// 系统闪存插件设置
// 系统插件设置
$this->app->event->listen('laket_admin_input_item_js_before', function($item) {
return $this->getInputItemJS($item);
});
Expand All @@ -114,7 +114,7 @@ protected function loadEvent()
return $this->getInputItem($item);
});

// 设置闪存插件
// 设置插件
$this->app->event->listen('laket_settings_input_item_js_before', function($item) {
return $this->getInputItemJS($item);
});
Expand All @@ -123,6 +123,15 @@ protected function loadEvent()
return $this->getInputItem($item);
});

// CMS
$this->app->event->listen('cms_input_item_js', function($item) {
return $this->getInputItemJS($item);
});

$this->app->event->listen('cms_input_item_editor', function($item) {
return laket_ueditor_bind("js-ueditor");
});

// 事件
if (class_exists(SettingsEvent\ConfigModelGetFieldType::class)) {
$this->app->event->listen(
Expand Down
6 changes: 3 additions & 3 deletions src/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ function laket_ueditor_config(string $key = null, $default = null) {
*/
function laket_ueditor_bind($id = '') {
$html = '
<script type="text/javascript" src="laket-ueditor/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="laket-ueditor/ueditor/ueditor.all.js"></script>
<script type="text/javascript" src="'.assets("laket-ueditor/ueditor/ueditor.config.js").'"></script>
<script type="text/javascript" src="'.assets("laket-ueditor/ueditor/ueditor.all.js").'"></script>
<script type="text/javascript">
var laket_ueditor = {
"upload_url": "'.laket_route("admin.laket-ueditor.upload").'?dir=images",
"bind_id": "'.$id.'"
};
</script>
<script type="text/javascript" src="laket-ueditor/ueditor.js"></script>
<script type="text/javascript" src="'.assets("laket-ueditor/ueditor.js").'"></script>
';

return $html;
Expand Down

0 comments on commit 1d3b501

Please sign in to comment.