Skip to content

Commit

Permalink
Merge pull request #11 from terranc/patch-1
Browse files Browse the repository at this point in the history
解决表单控件的id中有”-“而导致的js报错问题
  • Loading branch information
codingyu committed Jul 26, 2019
2 parents efadb3d + 616a075 commit 81cafb5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class Editor extends Field
public function render()
{
$name = $this->formatName($this->column);

$jsId = \Illuminate\Support\Str::studly($this->id);

$config = Ueditor::config('config', []);

Expand All @@ -28,9 +30,9 @@ public function render()
window.UEDITOR_CONFIG.serverUrl = '{$laravel_ueditor_route}';
UE.delEditor("{$this->id}");
var ue_{$this->id} = UE.getEditor('{$this->id}', {$config});
ue_{$this->id}.ready(function() {
ue_{$this->id}.execCommand('serverparam', '_token', '$token');
var ue_{$jsId} = UE.getEditor('{$this->id}', {$config});
ue_{$jsId}.ready(function() {
ue_{$jsId}.execCommand('serverparam', '_token', '$token');
});
EOT;
Expand Down

2 comments on commit 81cafb5

@terranc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发布个新版本呗

@codingyu
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@terranc 已更新

Please sign in to comment.