Skip to content

Ability to $set() value of CodeField and have that change reflected in Codemirror editor #9

@HelgeSverre

Description

@HelgeSverre

Calling $set() on the CodeField, has no effect, it will set the value (so it will be saved to the DB), but the codemirror editor will not pickup on the change.

Unsure how to resolve.

Can be reproduced by the following snippet:

 CodeField::make('html')
    ->label('Custom HTML')
    ->reactive()
    ->columnSpanFull()
    ->withLineNumbers()
    ->htmlField()
    ->minHeight(400)
    ->disableAutocompletion()
    ->hintAction(function (Closure $set) {
        return Action::make('make_html_go_brrrr')
            ->icon('heroicon-o-sparkles')
            ->label('Go brrrr')
            ->action(function () use ($set) {
                $set("html", "brrrrrrrr");
            });
    }),

The expected result is for the codemirror editor to now contain "brrrrrrrr", however it is blank "or has whatever value you wrote in before clicking the hintAction button)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions