Skip to content

Commit 81cafb5

Browse files
authored
Merge pull request #11 from terranc/patch-1
解决表单控件的id中有”-“而导致的js报错问题
2 parents efadb3d + 616a075 commit 81cafb5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Editor.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class Editor extends Field
1616
public function render()
1717
{
1818
$name = $this->formatName($this->column);
19+
20+
$jsId = \Illuminate\Support\Str::studly($this->id);
1921

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

@@ -28,9 +30,9 @@ public function render()
2830
2931
window.UEDITOR_CONFIG.serverUrl = '{$laravel_ueditor_route}';
3032
UE.delEditor("{$this->id}");
31-
var ue_{$this->id} = UE.getEditor('{$this->id}', {$config});
32-
ue_{$this->id}.ready(function() {
33-
ue_{$this->id}.execCommand('serverparam', '_token', '$token');
33+
var ue_{$jsId} = UE.getEditor('{$this->id}', {$config});
34+
ue_{$jsId}.ready(function() {
35+
ue_{$jsId}.execCommand('serverparam', '_token', '$token');
3436
});
3537
3638
EOT;

0 commit comments

Comments
 (0)