[Parchment] Maximum optimize iterations when creating Table blots

See original GitHub issue

I am trying to understand how blots work and I wanted to recreate step by step the Table example from the parchment repo. For now I wrote the following code:

import Quill from 'quill';
import { ContainerBlot } from 'parchment';

class TableBody extends ContainerBlot {}
TableBody.blotName = 'table-body';
TableBody.tagName = 'TBODY';

class Table extends ContainerBlot {}
Table.tagName = 'TABLE';
Table.blotName = 'table-container';
Table.allowedChildren = [TableBody];

Quill.register(Table, true);

and the main node on which Quill is instantiated has the following content:

<table>
    <tbody>
        <tr>
            <th><b>Title</b></th>
        </tr>
        <tr>
            <td >
                  Some row
            </td>
        </tr>
    </tbody>
</table>

and I get the following error:

bundle.js:231739 Uncaught Error: [Parchment] Maximum optimize iterations reached

Steps for Reproduction

Expected behavior:

I would expect only the <table><tbody></tbody></table> to render.

Actual behavior:

Error

Platforms:

Chrome MacOS Mojave

Version:

2.0.0-dev

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
Kiabacommented, Apr 21, 2021

I have the same problem. Who can help ?

0reactions
twada7777commented, Mar 11, 2022

Dose the following work?

- class Table extends ContainerBlot {}
+ class Table extends ContainerBlot {
+   optimize(context);
+   if (this.domNode.tagName !== this.statics.tagName[0]) {
+     this.replaceWith(this.statics.blotName);
+   }
+ }

- Table.tagName = 'TABLE';
+ Table.tagName = ['TABLE'. 'T'];

see also https://github.com/quilljs/quill/blob/develop/formats/bold.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular 5 and quilljs [Parchment] Unable to create blot
I was apple to fix my problem with next approach ... declare var Quill: any; const BlockEmbed = Quill.import('blots/embed'); export class ...
Read more >
Cloning Medium with Parchment - Quill Rich Text Editor
Cloning Medium with Parchment. To provide a consistent editing experience, you need both consistent data and predictable behaviors.
Read more >
Untitled
How to wear mini ugg boots, Css ul bullet not showing, Aang hallucinates, ... Body lice pictures symptoms, Me optimized alphawezen lyrics, Munisamy...
Read more >
Set Optimization Options - MATLAB & Simulink - MathWorks
Options Table ; MaxIter. The maximum number of iterations allowed. The default value is 500 for fminbnd and 200*length(x0) for fminsearch . fminbnd...
Read more >
Leverage Video to Reach Your Association Goals - WorkerBee.TV
As for their product, Duolingo is now the fourth highest ranking education app in ... Put simply, this is creating content your audience...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found