Closed (fixed)
Project:
BUEditor
Version:
6.x-2.2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
8 Jan 2011 at 02:16 UTC
Updated:
21 Jan 2011 at 22:17 UTC
I am tyring to list a table full of Unicode characters to insert from. I can work with the smiley button code listed here: http://ufku.com/drupal/bueditor/contributions/smileys
But I need to replace the list of smiley with the list of unicode characters. I converted the following code for smiley for my use. But it's not working! Not what I am doing wrong! :(
php:
if (!function_exists('_smileys_list')) return;
$L = drupal_to_js(_smileys_list());
$P = base_path();
drupal_add_js("(function($){
var click = function() {
BUE.active.replaceSelection(this.firstChild.alt, 'end');
return false;
};
var map = function(s) {
return $('<a href=\"#\" title=\"'+ s.description +'\"><img src=\"$P'+ s.image +'\" alt=\" '+ s.acronyms.split(' ')[0] +' \" /></a>').css('margin', '0.5em').click(click)[0];
};
BUE.smlyWrap = function() {
if (!BUE.\$smlyWrap) {
var links = $.map($L, map);
BUE.\$smlyWrap = $('<div style=\"width:200px\" class=\"bue-smiley-wrapper\"></div>').append(links);
}
return BUE.\$smlyWrap.clone(true);
};
})(jQuery);", 'inline');
return 'js: E.quickPop.open(BUE.smlyWrap());';
My code
js:
var L=[ "a", "b" ];
(function($){
var click = function() {
BUE.active.replaceSelection(this.firstChild.alt, 'end');
return false;
};
var map = function(s) {
return ('<a href=\"#\" title=\"'+ s +'\">s</a>').css('margin', '0.5em').click(click)[0];
};
BUE.banglaWrap = function() {
if (!BUE.banglaWrap) {
var links = .map(L, map);
BUE.banglaWrap = ('<div style=\"width:200px\" class=\"bue-smiley-wrapper\"></div>').append(links);
}
return BUE.banglaWrap.clone(true);
};
})(jQuery);
E.quickPop.open(BUE.banglaWrap());
Comments
Comment #1
ufku commentedHave you seen http://ufku.com/drupal/bueditor/contributions/special-characters ?
Comment #2
udvranto commentedWow! That's it!
But what if I want to show an abbreviated name instead of the character but insert the character instead? For example, the Unicode character ZWNJ (zero width non joiner) is an invisible character. To have it included I need to display either the string ZWNJ or an image containing ZWNJ/representative symbol and on click I need to actually insert it.
Comment #3
ufku commentedThen you need to create the chars and links this way:
Comment #4
udvranto commentedThanks this works! I am closing this issue.