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

form submission for colors plugin #1480

Open
Raf-sns opened this issue Aug 10, 2024 · 0 comments
Open

form submission for colors plugin #1480

Raf-sns opened this issue Aug 10, 2024 · 0 comments

Comments

@Raf-sns
Copy link

Raf-sns commented Aug 10, 2024

Hi, I tried the Colors plugin and I encountered a problem when validating the color choice with the color picker.
What I did:

  • Added the Colors plugin:
    <script src="../trumbowyg/dist/plugins/colors/trumbowyg.colors.min.js"></script>
  • I didn't add the plugin CSS file because I don't want a pre-defined color to choose from.
  • I defined the plugin options like this:
plugins: {
      colors: {
          allowCustomForeColor: true
      }
    }
  • I click on text color or background nailer.

  • I choose a color with the color-picker.

  • When I validate the chosen color, the browser sends a GET request with for example: /?color=%23df3030

  • My temporary solution:
    on the trumbowyg.js file on lines 1600 and 1608 I added this:

.on('submit', function (event) {
                        event.preventDefault();
                        $modal.trigger(CONFIRM_EVENT);
                        return false;
                    })

And

.on('submit reset', function (event) {
                        event.preventDefault();
                        if (t.o.autogrowOnEnter) {
                            t.autogrowOnEnterDontClose = false;
                        }
                    });

to block form submission by default.

  • This corrects the sending of the form by default but the color choice modal window no longer closes automatically.
    Thank you for your suggestions.
    Note: I'm a big fan of trumbowyg.js! Thank you for this great tool!
    Sincerely,
    Raf
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

No branches or pull requests

1 participant