Closed KiberMath closed 9 years ago
+1.
If you are using a modal you can have an OnSubmit parameter. I am totally noob in jquery but I could figure some things out by looking in the source code. There is an modal/transform for Youtube-video which can give you some clues.
video: {
title: CURLANG.video,
buttonHTML: '<span class="fonticon ve-tlb-video1">\uE008</span>',
modal: {
title: CURLANG.video,
width: "600px",
tabs: [
{
title: CURLANG.video,
input: [
{param: "SRC",title:CURLANG.modal_video_text}
]
}
],
onSubmit: function(cmd,opt,queryState) {
var url = this.$modal.find('input[name="SRC"]').val();
if (url) {
url = url.replace(/^\s+/,"").replace(/\s+$/,"");
}
var a;
if (url.indexOf("youtu.be")!=-1) {
a = url.match(/^http[s]*:\/\/youtu\.be\/([a-z0-9_-]+)/i);
}else{
a = url.match(/^http[s]*:\/\/www\.youtube\.com\/watch\?.*?v=([a-z0-9_-]+)/i);
}
if (a && a.length==2) {
var code = a[1];
this.insertAtCursor(this.getCodeByCommand(cmd,{src:code}));
}
this.closeModal();
this.updateUI();
return false;
}
},
transform: {
'<iframe src="http://www.youtube.com/embed/{SRC}" width="640" height="480" frameborder="0"></iframe>':'[video]{SRC}[/video]'
From this I managed to add som custom bbcodes and I dont think your transform would be a problem. Good Luck!
+1 I need to be able to process between transforms.
onTransform: function(cmd,opt,queryState){}
as i can se now in this plugin we can use only simple transform
but i need more advanced one.
for example
if want to add tag [img id=234]
and transform it with function