Closed TobiasW00 closed 10 years ago
I'll have a look if I can fix this problem.
I can't reproduce this issue on http://cognistreamer.github.io/tinyMCE-mention/. Are you using the latest version of tinyMCE(4.0.26)?
I was having this same issue with and older version of your code. Looks like it was fixed by the following:
Thanks @JacobC123, I'll close this one.
Thanks Steven! I'm sorry I didn’t respond quickly. I updated my tinymce Version, but der Problem still exists: http://youtu.be/zodIdDiYyLM
Maybe I have an error in my own js. Could y do a quick review? Maybe I did implemented it the wrong way. Thank you!
Bug: http://youtu.be/zodIdDiYyLM
Code: tinymce.init({ selector: "#personinputboxtex", menubar:false, height : "34", plugins: "autoresize,paste,mention", toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent ", mentions: { delimiter: ['@', '#','['], source: function (query, process, delimiter) {
// Do your ajax call
// When using multiple delimiters you can alter the query depending on the delimiter used $(inputPersonbox).find('.dummy').html();
if (delimiter === '@') {
var dataPersonString = "term=" + query
$.ajax({
url: "JSON/GETPERSONS",
dataType: "json",
data: dataPersonString,
success: function( data, textStatus, jqXHR) {
process(data);
},
error: function(jqXHR, textStatus, errorThrown){
console.log( textStatus);
}
});
}
if (delimiter === '#') {
var dataString = "term=" + query
$.ajax({
url: "JSON/GETTAGSS",
data: dataString,
dataType: "json",
success: function( data, textStatus, jqXHR) {
process(data);
},
error: function(jqXHR, textStatus, errorThrown){
console.log( textStatus);
}
});
}
//
if (delimiter === '[') {
var dataString = "term=" + query
$.ajax({
url: "/list/json",
data: dataString,
dataType: "json",
success: function( data, textStatus, jqXHR) {
process(data);
},
error: function(jqXHR, textStatus, errorThrown){
console.log( textStatus);
}
});
}
}, insert: function(item) {
try {
if (item.listid){
var listid = item.listid;
return '<a data-listid=\"' + listid + '\" href=\"/list/'+ listid +'/\">[' + item.label + ']';
}
if (item.personid){
return '<a href=\"/profile/'+ item.personid +'/\">@' + item.name + '';
}
if (item.id){
return '<a href=\"/tag/' + item.id + '/\" alt=\"Taglink\">' + item.name + '';
}
}
catch(e)
{
alert(e);
return '' + item.name + '';
}
}
}
});
@TobiasW00 I'd recommend that you test the demo at http://cognistreamer.github.io/tinyMCE-mention/. If it's working there, it's probably an issue with your code. And I'd recommend StackOverflow for code related questions. GitHub should really be for development, not support - open source devs are already giving enough away for free :) However, if you're able to reproduce there and it is a bug, then let someone here know!
@TobiasW00, I did a quick test using multiple delimiters and didn't experience any problems. I suggest you try to debug your local code and find out what is causing the problem.
Hello! Thank you for this nice piece of code! If I use Firefox or Chrome I can click on the Element and it gets inserted in the textbox. If I do the same on IE 11 the selectbox disappers and the item is not inserted. Any Idea?
Thank you!