简体   繁体   中英

trumbowyg plugin won't post

I'm using the WYSIWYG editor trumbowyg to supplement the fact that our CMS sucks. The plan is to help out our authors with the HTML without removing the current system they have in place, which is just a plain form with an textarea for article content.

Unfortunately, after activating trumbowyg on the textarea , nothing posts with it, no matter what I do.

When I say "nothing posts", I mean that the form worked before I added the JavaScript to it, and stopped working after, and I am referring to PHP's $_POST array.

Here's what I've tried (although before I was just doing the basics listed on their website ):

<form enctype="multipart/form-data" name="form" method="post">
    <!--other inputs ignored, but present-->
    <textarea name="article"></textarea> <!--this is the textarea in question-->
</form>
(function(textarea) {
  textarea.trumbowyg({ closable: true }).on('tbwblur', function() {
    console.log('working'); //This works
    textarea.text(textarea.trumbowyg('html'));
  });
})($("textarea[name=article]"));

I did start with the following, which didn't work:

$("textarea[name=article]").trumbowyg({ closable: true });

I was having a similar issue and couldn't find a solution anywhere. After submitting my question to Alex (the author of Trumbowyg), I realized the answer was staring me in the face in the Trumbowyg docs. See https://github.com/Alex-D/Trumbowyg/issues/341 .

Trumbowyg Docs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM