TypeError: Cannot read properties of null (reading 'getContent')

Open
#83 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
html
Domain
frontend

Research direction

The issue points to updateTinyVal and dynamically rendered <Editor> components in a Blazor list. Start by tracing how the wrapper gets the TinyMCE instance when an item is added; reproduce the failure with AddItemToListOfItems and compare it with the working loop. Done means adding an item no longer triggers the null getContent error and existing editor binding still works.

Written by the indexing model from the issue text.

Description

bug status: escalated

Specific code that throws the error:

const updateTinyVal = (id, val) => { if (getTiny() && getTiny().get(id).getContent() !== val) { getTiny().get(id).setContent(val); } };

Happens when i try to build it dynamically e.g.

This works:

foreach (var item in listOfItems)
{
    <Editor @bind-Text="item.Text"/>
}

This doesnt:

<Button OnClick="AddItemToListOfItems"/>
foreach (var item in listOfItems)
{
    <Editor @bind-Text="item.Text"/>
}

Not sure why.

Dominant language
HTML
Stars
57
Forks
17
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tinymce/tinymce-blazor

All issues in tinymce/tinymce-blazor

Similar issues

More Web Dev issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.