Thanks for great work.
Actually I wish I have met your solution 1 year ago.
I have problem.
- the wire:ignore did not work.
<div wire:ignore >
<textarea wire:ignore wire.model.lazy="content" ... />
</div>
If I put values on another input field, the ckeditor frame in textarea is disappeared.
The "wire:ignore" does not work.
So I added Wire Key
<textarea wire:ignore wire:key="editor-{{ now() }}" wire.model.lazy="content" ... />
This time, the CkEditor frame was not disappeared. Good.
But this time, If I put value in input field, the textarea refresh automatically with keeping data.
It is just once being disappered and came back.
Textarea does not refresh any more with another putting value in second / thrid input field.
I would like to stop refreshing Textarea .
This is What I did.
make:livewire PostComponent
in post-component.blade.php
<div wire:ignore class="form-group">
<input wire:model.lazy="title" />
</div>
<div wire:ignore class="form-group">
@include('includes.editor-input')
</div>
in includes/editor-input.blade.php
<div wire:ignore >
<label class="col-sm-2 control-label" for=" ">Content </label>
<div class="col-sm-10" >
<div class=" border border-gray-600 " >
<textarea
wire:ignore
wire:key="editor-{{ now() }}"
class="w-full" wire:model.lazy="content" name="content" id="content"></textarea>
</div>
<div>
@error('content') <span class="text-red-500 text-xs">{{ $message }}</span> @enderror
</div>
</div>
<script src="https://cdn.ckeditor.com/4.16.1/full/ckeditor.js"></script>
<script>
const editor = CKEDITOR.replace('content', {
height: 250
, filebrowserUploadUrl: "{{ route( 'upload', ['_token'=> csrf_token() ] ) }}"
, filebrowserUploadMethod: 'form'
});
editor.on('change', function(event) {
@this.set('content', event.editor.getData());
})
CKEDITOR.config.allowedContent = true;
CKEDITOR.filebrowserUploadMethod = 'form';
CKEDITOR.editorConfig = function(config) {
config.extraPlugins = 'colorbutton,colordialog,panelbutton';
};
CKEDITOR.on('dialogDefinition', function(ev) {
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
if (dialogName == 'image') {
var infoTab2 = dialogDefinition.getContents('advanced');
dialogDefinition.removeContents('advanced');
var infoTab = dialogDefinition.getContents('info');
infoTab.remove('txtBorder');
infoTab.remove('cmbAlign');
infoTab.remove('txtWidth');
infoTab.remove('txtHeight');
infoTab.remove('txtCellSpace');
infoTab.remove('txtCellPad');
infoTab.remove('txtCaption');
infoTab.remove('txtSummary');
}
});
</script>
</div>
I struggled for whole day with this.
Can some guys explain why 'wire:ignore' not work and how to stop refreshing Textarea field.