我目前正在使用Jquery / Javascript编写一个易于编辑的BB代码脚本。唯一的问题是它不像我想的那么容易,所以我需要一些帮助。
脚本运行正常(将内容添加到textarea中)。但是我试图让演示文稿更好一些。
如果有人可以告诉我如何取消列表项目或者至少隐藏buttet点(可能使用css这样做),我将不胜感激,否则我可以编辑javascript / jquery。
此外,当我滚动一个选项(对于粗体按钮)时,它显示按钮的代码(作为标题)我想删除它但我无法看到代码在哪里编辑它。
这是我的javascript代码:
// ----------------------------------------------------------------------------
// markItUp!
// ----------------------------------------------------------------------------
// Copyright (C) 2008 Jay Salvat
// http://markitup.jaysalvat.com/
// ----------------------------------------------------------------------------
myBbcodeSettings = {
nameSpace: "bbcode", // Useful to prevent multi-instances CSS conflict
previewParserPath: "~/sets/bbcode/preview.php",
markupSet: [
{name:"<img src='_img/bold_icon.gif'>", key:'B', openWith:'[b]', closeWith:'[/b]'},
{name:'Italic', key:'I', openWith:'[i]', closeWith:'[/i]'},
{name:'Underline', key:'U', openWith:'[u]', closeWith:'[/u]'},
{separator:'---------------' },
{name:'Picture', key:'P', replaceWith:'[img][![Url]!][/img]'},
{name:'Link', key:'L', openWith:'[url=[![Url]!]]', closeWith:'[/url]', placeHolder:'Your text to link here...'},
{separator:'---------------' },
{name:'Colors', openWith:'[color=[![Color]!]]', closeWith:'[/color]', dropMenu: [
{name:'Yellow', openWith:'[color=yellow]', closeWith:'[/color]', className:"col1-1" },
{name:'Orange', openWith:'[color=orange]', closeWith:'[/color]', className:"col1-2" },
{name:'Red', openWith:'[color=red]', closeWith:'[/color]', className:"col1-3" },
{name:'Blue', openWith:'[color=blue]', closeWith:'[/color]', className:"col2-1" },
{name:'Purple', openWith:'[color=purple]', closeWith:'[/color]', className:"col2-2" },
{name:'Green', openWith:'[color=green]', closeWith:'[/color]', className:"col2-3" },
{name:'White', openWith:'[color=white]', closeWith:'[/color]', className:"col3-1" },
{name:'Gray', openWith:'[color=gray]', closeWith:'[/color]', className:"col3-2" },
{name:'Black', openWith:'[color=black]', closeWith:'[/color]', className:"col3-3" }
]},
{name:'Size', key:'S', openWith:'[size=[![Text size]!]]', closeWith:'[/size]', dropMenu :[
{name:'Big', openWith:'[size=200]', closeWith:'[/size]' },
{name:'Normal', openWith:'[size=100]', closeWith:'[/size]' },
{name:'Small', openWith:'[size=50]', closeWith:'[/size]' }
]},
{separator:'---------------' },
{name:'Bulleted list', openWith:'[list]\n', closeWith:'\n[/list]'},
{name:'Numeric list', openWith:'[list=[![Starting number]!]]\n', closeWith:'\n[/list]'},
{name:'List item', openWith:'[*] '},
{separator:'---------------' },
{name:'Quotes', openWith:'[quote]', closeWith:'[/quote]'},
{name:'Code', openWith:'[code]', closeWith:'[/code]'},
{separator:'---------------' },
{name:'Clean', className:"clean", replaceWith:function(h) { return h.selection.replace(/\[(.*?)\]/g, "") } },
{name:'Preview', className:"preview", call:'preview' }
]
}
感谢您给我的任何帮助! :)
答案 0 :(得分:1)
使用PHP进行解析,并使用简单的脚本添加文本。
答案 1 :(得分:0)
也许您可以尝试使用composer packagist BB代码。请参阅:https://packagist.org/?q=bbcode&idx=packagist&p=0