You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added a bullet list, applied indentation, and tried to submit the form, but I'm getting a Console error: Uncaught InternalError: too much recursion. I customized the indentation to use inline styles instead of classes.
Below is my script function.
function TextAreaToEditor()
{
//Define a custom attributor for text-indent
class IndentAttributor extends Parchment.StyleAttributor {
add(node, value) {
console.log(value);
const normalizedValue = typeof value === 'string'
? parseFloat(value) : value;
if (normalizedValue === 0) {
this.remove(node);
return true;
} else {
return super.add(node, `${normalizedValue}em`);
}
}
}
// Registering the IndentAttributor
const IndentStyle = new IndentAttributor('indent', 'padding-left', {
scope: Parchment.Scope.BLOCK,
whitelist: ['1em', '2em', '3em', '4em', '5em', '6em', '7em', '8em', '9em']
});
Quill.register(IndentStyle, true);
// Default toolbar options for the Quill editor
const toolbarOptions = [
[
{ 'font': [] },
{ 'size': ['10px', false, '18px', '32px'] }
],
[{ 'color': [] }, { 'background': [] }],
[
'bold', 'italic', 'underline', 'strike',
{ 'script': 'sub' }, { 'script': 'super' }
],
[{ 'list': 'ordered' }, { 'list': 'bullet' }, { 'align': [] }],
[{ 'indent': '-1' }, { 'indent': '+1' }],
['link', 'blockquote', 'clean']
];
var defaultOptions = {
theme: 'snow',
modules: {
toolbar: toolbarOptions,
}
};
// Merge user options with default options
var quillOptions = Object.assign({}, defaultOptions);
// Initialize Quill on all elements with the specified class
document.querySelectorAll('.txt-area-editor').forEach(function(textarea) {
// Create a new div to replace the textarea
var quillDiv = document.createElement('div');
quillDiv.style.height = '200px';
quillDiv.innerHTML = textarea.value;
textarea.parentNode.insertBefore(quillDiv, textarea);
textarea.style.display = 'none';
// Initialize Quill on the new div
var quill = new Quill(quillDiv, quillOptions);
// Store the Quill instance in a data attribute on the textarea
$(textarea).data('quillInstance', quill);
});
}
I used getSemanticHTML() to get the html data from editor and store it in database.
function GetDatafromTextEditortoTextArea() {
$('.txt-area-editor').each(function() {
const quillEditor = $(this).data('quillInstance');
if (quillEditor) {
$(this).val(quillEditor.getSemanticHTML());
}
});
}
NOTE: Console error occur after using getSemanticHTML(), before that I used innerHTML .How to fix this?
The text was updated successfully, but these errors were encountered:
I added a bullet list, applied indentation, and tried to submit the form, but I'm getting a Console error: Uncaught InternalError: too much recursion. I customized the indentation to use inline styles instead of classes.
Below is my script function.
function TextAreaToEditor()
{
}
I used getSemanticHTML() to get the html data from editor and store it in database.
function GetDatafromTextEditortoTextArea() {
$('.txt-area-editor').each(function() {
const quillEditor = $(this).data('quillInstance');
if (quillEditor) {
$(this).val(quillEditor.getSemanticHTML());
}
});
}
NOTE: Console error occur after using getSemanticHTML(), before that I used innerHTML .How to fix this?
The text was updated successfully, but these errors were encountered: