多个WMD编辑器(SO分叉版)在一个页面上? [英] Multiple WMD editors (SO forked version) on one page?

查看:105
本文介绍了多个WMD编辑器(SO分叉版)在一个页面上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要说清楚,我指的是使用 stackoverflow的分叉WMD 来自attacklab的原始版本

To be clear, I'm referring to the usage of stackoverflow's forked WMD, not the original version from attacklab.

我想使用分叉版本,但是看起来脚本用来识别WMDify页面元素的div id是在<$中硬编码的c $ c> wmd.js:66 :

I'd like to use the forked version, however it seems that the div id's which are used by the script to identify the page elements to WMDify are hardcoded in wmd.js:66:

// A collection of the important regions on the page.
// Cached so we don't have to keep traversing the DOM.
wmd.PanelCollection = function(){
    this.buttonBar = doc.getElementById("wmd-button-bar");
    this.preview = doc.getElementById("wmd-preview");
    this.output = doc.getElementById("wmd-output");
    this.input = doc.getElementById("wmd-input");
};

如果我只是想使用不同的地区名称,我自己就可以了 - 但我想要在单个页面上使用可变数量的WMD编辑器。我需要一种方法来告诉每个WMD实例它应该影响的页面区域,但是我没有看到任何挂钩。

If I just wanted to use different region names I'd be fine on my own—but I want to use a variable number of WMD editors on a single page. I'd need a way to tell each instance of WMD about the page regions it should affect, but I don't see any 'hooks' for that.

不是 - 观光可能是我几乎完全缺乏js知识的产物。正确的事情和交易;是为了正确学习javascript,但我正处于一个截止日期的项目中。我真的很想使用这个版本的WMD,但我需要一些关于如何修改WMD脚本的线索,或者只是一个如何以一种我可以指定使用哪个div id的方式调用它的例子。

The not-seeing is likely a product of my almost complete lack of js knowledge. The Right Thing To Do™ is to just learn javascript properly, but I'm in the middle of a project with a deadline. I'd really like to use this version of WMD but I need some clues on how to go about modifying the WMD script, or perhaps simply an example of how to call it in such a fashion that I can speficy which div id's to use.

线索赞赏!

推荐答案

我有类似的问题所以我有能力的大规模杀伤性武器能够做到这一点。
我的wmd版本

I had similar problems so I re-factored WMD to be able to do just that. my version of wmd

最近,我重新检查了这一点。 Google代码中的版本支持网页上的多个版本。

google code fork 并且是最新的。

Recently, I rechecked this. The version in Google code supports multiple versions on a page.
google code fork and is the latest out there.

这篇关于多个WMD编辑器(SO分叉版)在一个页面上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆