From 41eb2cbeb26ba4eb77a7752a3e675c833fce5bad Mon Sep 17 00:00:00 2001
From: Jonny Eleven <948800401@qq.com>
Date: Wed, 15 Dec 2021 17:47:24 +0800
Subject: [PATCH 1/2] fix editors initialed twice
---
resources/views/editor.blade.php | 2 +-
src/Editor.php | 25 +++++++------------------
2 files changed, 8 insertions(+), 19 deletions(-)
diff --git a/resources/views/editor.blade.php b/resources/views/editor.blade.php
index 14adba6..8401fb9 100644
--- a/resources/views/editor.blade.php
+++ b/resources/views/editor.blade.php
@@ -6,7 +6,7 @@
@include('admin::form.error')
-
+
{!! old($column, $value) !!}
diff --git a/src/Editor.php b/src/Editor.php
index 1ecee17..33ae41e 100644
--- a/src/Editor.php
+++ b/src/Editor.php
@@ -39,35 +39,24 @@ public function render()
$options = json_encode($options);
$this->script = <<
Date: Wed, 15 Dec 2021 18:32:55 +0800
Subject: [PATCH 2/2] fix a bug
---
src/Editor.php | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/Editor.php b/src/Editor.php
index 33ae41e..8bde712 100644
--- a/src/Editor.php
+++ b/src/Editor.php
@@ -42,10 +42,9 @@ public function render()
Quill.register("modules/htmlEditButton", htmlEditButton);
// init last editor for adding
-var options = {$options},
- editorClass = 'quill-{$this->id}';
+var options = {$options};
-$('.' + editorClass).each(function(index, item) {
+$('.quill-{$this->id}').each(function(index, item) {
if( false === $(this).data('initialed') ) { // prevent initialed twice
new Quill(item, options);
$(this).data('initialed', true); // mark the editor as initialed
@@ -54,8 +53,7 @@ public function render()
});
$('button[type="submit"]').click(function() {
- var editorConent = '';
- $('.' + editorClass).each(function(index, item) {
+ $('.quill-{$this->id}').each(function(index, item) {
editorConent = item.children[0].innerHTML;
$(this).siblings('input[type="hidden"]').val(editorConent);
});