开发者

TinyMCE content/HTML filtering

开发者 https://www.devze.com 2023-02-13 17:44 出处:网络
I\'ll show you what I want to achieve. I have some entities on my website(players, teams, articles, photos etc). I want to make some kind of开发者_StackOverflow BBcode that will create links to these

I'll show you what I want to achieve. I have some entities on my website(players, teams, articles, photos etc). I want to make some kind of开发者_StackOverflow BBcode that will create links to these elements. (I definitely don't want to use native link button for many reasons like changing url structure etc).

So I want to put into HTML code something like this: [player=123ID]anchor text[/player]. After saving I will parse this HTML with my custom filter to make this linkable when showing on website in articles, private messages etc.

But my question is:

  1. Is it possible to make custom TinyMCE editor button(one for each entity) that will open some kind of modal window where I'll add JS logic that will offer user some related autocompleter? And after selecting entity user wanted + writing anchor text it will put into HTML code my custom BBcode tag. Any guides, best practices, etc?

  2. Is it possible to show in preview(not HTML) mode this custom BBtag as anchor? TinyMCE by default shows anchor tags like real anchors with anchor text, I want this custom tag to be shown(and editable) in the same way as regular anchors do. Do you have any ideas?

I am currently studying moxiecode wiki for some days, but I'm still not that in-depth in TinyMCE to solve this easily.

Will be happy for your inputs!

Regards, Jim


To question 1: Yes this is possible. You might want to have a look at how to create a plugin for tinymce. It is not that difficult and you may create as many buttons as you need.

What "preview" mode are you reffering to?

0

精彩评论

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