[ Index ] |
|
Code source de Kupu-1.3.5 |
1 /* here's where the customized initialization will be done */ 2 3 function RoundupLinkTool() { 4 this.createLinkHandler = function(event) { 5 /* create a link according to a url entered in a popup */ 6 var linkWindow = openPopup('_file/kupu/common/popups/link.html', 300, 200); 7 linkWindow.linktool = this; 8 linkWindow.focus(); 9 }; 10 }; 11 12 RoundupLinkTool.prototype = new LinkTool; 13 14 function RoundupImageTool() { 15 this.createImageHandler = function(event) { 16 /* create an image according to a url entered in a popup */ 17 var imageWindow = openPopup('_file/kupu/common/popups/image.html', 300, 200); 18 imageWindow.imagetool = this; 19 imageWindow.focus(); 20 }; 21 }; 22 23 RoundupImageTool.prototype = new ImageTool; 24 25 function initKupu(iframe) { 26 /* Although this is meant to be a sample implementation, it can 27 be used out-of-the box to run the sample pagetemplate or for simple 28 implementations that just don't use some elements. When you want 29 to do some customization, this should probably be overridden. For 30 larger customization actions you will have to subclass or roll your 31 own UI object. 32 */ 33 34 // first we create a logger 35 var l = new DummyLogger(); 36 37 // now some config values 38 // XXX To mimic the 'old' behaviour, vars should be retrieved from the 39 // iframe (attributes) 40 var src = iframe.getAttribute('src'); 41 var dst = iframe.getAttribute('dst'); 42 if (!dst) { 43 dst = '..'; 44 } 45 var use_css = (iframe.getAttribute('usecss') != "0"); 46 var reload_src = (iframe.getAttribute('reloadsrc') == "1"); 47 var strict_output = (iframe.getAttribute('strict_output') == "1"); 48 var content_type = 'application/xhtml+xml'; 49 if (iframe.getAttribute('content_type')) { 50 content_type = iframe.getAttribute('content_type'); 51 }; 52 53 var conf = {'src': src, 54 'dst': dst, 55 'use_css': use_css, 56 'reload_after_save': reload_src, 57 'strict_output': strict_output, 58 'content_type': content_type 59 }; 60 61 // the we create the document, hand it over the id of the iframe 62 var doc = new KupuDocument(iframe); 63 64 // now we can create the controller 65 var kupu = new KupuEditor(doc, conf, l); 66 67 // add the contextmenu 68 var cm = new ContextMenu(); 69 kupu.setContextMenu(cm); 70 71 var listtool = new ListTool('kupu-list-ul-addbutton', 'kupu-list-ol-addbutton', 'kupu-ulstyles', 'kupu-olstyles'); 72 kupu.registerTool('listtool', listtool); 73 74 var linktool = new RoundupLinkTool(); 75 kupu.registerTool('linktool', linktool); 76 77 var imagetool = new RoundupImageTool(); 78 kupu.registerTool('imagetool', imagetool); 79 80 // now we can create a UI object which we can use from the UI 81 var ui = new KupuUI('kupu-tb-styles'); 82 83 // the ui must be registered to the editor as well so it can be notified 84 // of state changes 85 kupu.registerTool('ui', ui); // XXX Should this be a different method? 86 87 // register some cleanup filter 88 // remove tags that aren't in the XHTML DTD 89 var nonxhtmltagfilter = new NonXHTMLTagFilter(); 90 kupu.registerFilter(nonxhtmltagfilter); 91 92 return kupu; 93 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 15:30:41 2007 | par Balluche grâce à PHPXref 0.7 |