Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add macro in editor builder #225

Merged
merged 3 commits into from
Aug 31, 2024
Merged

feat: add macro in editor builder #225

merged 3 commits into from
Aug 31, 2024

Conversation

yajra
Copy link
Owner

@yajra yajra commented Aug 31, 2024

Usage

        Editor::macro('focusOnOpen', function (string $field) {
            /** @var Editor $this */
            $this->onOpen("function() { $('#DTE_Field_{$field}').focus(); }");

            return $this;
        });

        Editor::macro('submitOnReturn', function (string|bool $action = 'submit') {
            /** @var Editor $this */
            $this->formOptionsMain(['onReturn' => $action]);

            return $this;
        });

Use Case

                Editor::make()
                    ->ajax(route('accounts.store', $this->account))
                    ->submitOnReturn(false)
                    ->focusOnOpen('amount')

Copy link

sonarcloud bot commented Aug 31, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

@yajra yajra merged commit 6605d8b into master Aug 31, 2024
9 of 10 checks passed
@yajra yajra deleted the macro-editor branch August 31, 2024 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant