开发者

jQuery-based version of WMD editor (the SO version ideally)

开发者 https://www.devze.com 2023-01-31 10:25 出处:网络
Here are the facts as they stand: I have a Django admin page although this question has nothing to do with Django.

Here are the facts as they stand:

  • I have a Django admin page although this question has nothing to do with Django.
  • This page has multiple <textarea> boxes.
  • I want to be able to go $('textarea.wmd').wmd() and see 开发者_运维知识库WMD editor bars appear over the top of my <textarea>s.

I've had a hack around with the original WMD version and a poke with Dana's SO version... But they're both global (attach to one ID). I've also seen mooWMD which is a MooTools port of Dana's SO version but I've ridden the MooTools train before and I've no wish to haul that into my admin pages.

So quite simply, is there a jQuery port of Dana's (or other) code that can attach itself to multiple targets?


I found this WMD jquery plugin after a quick search: https://github.com/openlibrary/wmd

It's a fork of Dana's SO version, and one of the major changes in the Readme states that it can work with multiple textareas in the same page, and is a jQuery plugin.

Include the script on your page, and then call it on your textareas like this:

$(function() {
  $('textarea.wmd').wmd();
});

As far as I am aware, this answers your question.

0

精彩评论

暂无评论...
验证码 换一张
取 消