summaryrefslogtreecommitdiff
path: root/public/javascripts/tiny_mce/plugins/example
diff options
context:
space:
mode:
Diffstat (limited to 'public/javascripts/tiny_mce/plugins/example')
-rwxr-xr-xpublic/javascripts/tiny_mce/plugins/example/dialog.htm27
-rwxr-xr-xpublic/javascripts/tiny_mce/plugins/example/editor_plugin.js1
-rwxr-xr-xpublic/javascripts/tiny_mce/plugins/example/editor_plugin_src.js81
-rwxr-xr-xpublic/javascripts/tiny_mce/plugins/example/img/example.gifbin0 -> 87 bytes
-rwxr-xr-xpublic/javascripts/tiny_mce/plugins/example/js/dialog.js19
-rwxr-xr-xpublic/javascripts/tiny_mce/plugins/example/langs/en.js3
-rwxr-xr-xpublic/javascripts/tiny_mce/plugins/example/langs/en_dlg.js3
7 files changed, 134 insertions, 0 deletions
diff --git a/public/javascripts/tiny_mce/plugins/example/dialog.htm b/public/javascripts/tiny_mce/plugins/example/dialog.htm
new file mode 100755
index 0000000..b4c6284
--- /dev/null
+++ b/public/javascripts/tiny_mce/plugins/example/dialog.htm
@@ -0,0 +1,27 @@
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml">
3<head>
4 <title>{#example_dlg.title}</title>
5 <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
6 <script type="text/javascript" src="js/dialog.js"></script>
7</head>
8<body>
9
10<form onsubmit="ExampleDialog.insert();return false;" action="#">
11 <p>Here is a example dialog.</p>
12 <p>Selected text: <input id="someval" name="someval" type="text" class="text" /></p>
13 <p>Custom arg: <input id="somearg" name="somearg" type="text" class="text" /></p>
14
15 <div class="mceActionPanel">
16 <div style="float: left">
17 <input type="button" id="insert" name="insert" value="{#insert}" onclick="ExampleDialog.insert();" />
18 </div>
19
20 <div style="float: right">
21 <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
22 </div>
23 </div>
24</form>
25
26</body>
27</html>
diff --git a/public/javascripts/tiny_mce/plugins/example/editor_plugin.js b/public/javascripts/tiny_mce/plugins/example/editor_plugin.js
new file mode 100755
index 0000000..cb7010d
--- /dev/null
+++ b/public/javascripts/tiny_mce/plugins/example/editor_plugin.js
@@ -0,0 +1 @@
(function(){tinymce.PluginManager.requireLangPack('example');tinymce.create('tinymce.plugins.ExamplePlugin',{init:function(ed,url){ed.addCommand('mceExample',function(){ed.windowManager.open({file:url+'/dialog.htm',width:320+parseInt(ed.getLang('example.delta_width',0)),height:120+parseInt(ed.getLang('example.delta_height',0)),inline:1},{plugin_url:url,some_custom_arg:'custom arg'});});ed.addButton('example',{title:'example.desc',cmd:'mceExample',image:url+'/img/example.gif'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('example',n.nodeName=='IMG');});},createControl:function(n,cm){return null;},getInfo:function(){return{longname:'Example plugin',author:'Some author',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example',version:"1.0"};}});tinymce.PluginManager.add('example',tinymce.plugins.ExamplePlugin);})(); \ No newline at end of file
diff --git a/public/javascripts/tiny_mce/plugins/example/editor_plugin_src.js b/public/javascripts/tiny_mce/plugins/example/editor_plugin_src.js
new file mode 100755
index 0000000..5050550
--- /dev/null
+++ b/public/javascripts/tiny_mce/plugins/example/editor_plugin_src.js
@@ -0,0 +1,81 @@
1/**
2 * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
3 *
4 * @author Moxiecode
5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
6 */
7
8(function() {
9 // Load plugin specific language pack
10 tinymce.PluginManager.requireLangPack('example');
11
12 tinymce.create('tinymce.plugins.ExamplePlugin', {
13 /**
14 * Initializes the plugin, this will be executed after the plugin has been created.
15 * This call is done before the editor instance has finished it's initialization so use the onInit event
16 * of the editor instance to intercept that event.
17 *
18 * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
19 * @param {string} url Absolute URL to where the plugin is located.
20 */
21 init : function(ed, url) {
22 // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
23 ed.addCommand('mceExample', function() {
24 ed.windowManager.open({
25 file : url + '/dialog.htm',
26 width : 320 + parseInt(ed.getLang('example.delta_width', 0)),
27 height : 120 + parseInt(ed.getLang('example.delta_height', 0)),
28 inline : 1
29 }, {
30 plugin_url : url, // Plugin absolute URL
31 some_custom_arg : 'custom arg' // Custom argument
32 });
33 });
34
35 // Register example button
36 ed.addButton('example', {
37 title : 'example.desc',
38 cmd : 'mceExample',
39 image : url + '/img/example.gif'
40 });
41
42 // Add a node change handler, selects the button in the UI when a image is selected
43 ed.onNodeChange.add(function(ed, cm, n) {
44 cm.setActive('example', n.nodeName == 'IMG');
45 });
46 },
47
48 /**
49 * Creates control instances based in the incomming name. This method is normally not
50 * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
51 * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
52 * method can be used to create those.
53 *
54 * @param {String} n Name of the control to create.
55 * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
56 * @return {tinymce.ui.Control} New control instance or null if no control was created.
57 */
58 createControl : function(n, cm) {
59 return null;
60 },
61
62 /**
63 * Returns information about the plugin as a name/value array.
64 * The current keys are longname, author, authorurl, infourl and version.
65 *
66 * @return {Object} Name/value array containing information about the plugin.
67 */
68 getInfo : function() {
69 return {
70 longname : 'Example plugin',
71 author : 'Some author',
72 authorurl : 'http://tinymce.moxiecode.com',
73 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example',
74 version : "1.0"
75 };
76 }
77 });
78
79 // Register plugin
80 tinymce.PluginManager.add('example', tinymce.plugins.ExamplePlugin);
81})(); \ No newline at end of file
diff --git a/public/javascripts/tiny_mce/plugins/example/img/example.gif b/public/javascripts/tiny_mce/plugins/example/img/example.gif
new file mode 100755
index 0000000..1ab5da4
--- /dev/null
+++ b/public/javascripts/tiny_mce/plugins/example/img/example.gif
Binary files differ
diff --git a/public/javascripts/tiny_mce/plugins/example/js/dialog.js b/public/javascripts/tiny_mce/plugins/example/js/dialog.js
new file mode 100755
index 0000000..fa83411
--- /dev/null
+++ b/public/javascripts/tiny_mce/plugins/example/js/dialog.js
@@ -0,0 +1,19 @@
1tinyMCEPopup.requireLangPack();
2
3var ExampleDialog = {
4 init : function() {
5 var f = document.forms[0];
6
7 // Get the selected contents as text and place it in the input
8 f.someval.value = tinyMCEPopup.editor.selection.getContent({format : 'text'});
9 f.somearg.value = tinyMCEPopup.getWindowArg('some_custom_arg');
10 },
11
12 insert : function() {
13 // Insert the contents from the input into the document
14 tinyMCEPopup.editor.execCommand('mceInsertContent', false, document.forms[0].someval.value);
15 tinyMCEPopup.close();
16 }
17};
18
19tinyMCEPopup.onInit.add(ExampleDialog.init, ExampleDialog);
diff --git a/public/javascripts/tiny_mce/plugins/example/langs/en.js b/public/javascripts/tiny_mce/plugins/example/langs/en.js
new file mode 100755
index 0000000..e0784f8
--- /dev/null
+++ b/public/javascripts/tiny_mce/plugins/example/langs/en.js
@@ -0,0 +1,3 @@
1tinyMCE.addI18n('en.example',{
2 desc : 'This is just a template button'
3});
diff --git a/public/javascripts/tiny_mce/plugins/example/langs/en_dlg.js b/public/javascripts/tiny_mce/plugins/example/langs/en_dlg.js
new file mode 100755
index 0000000..ebcf948
--- /dev/null
+++ b/public/javascripts/tiny_mce/plugins/example/langs/en_dlg.js
@@ -0,0 +1,3 @@
1tinyMCE.addI18n('en.example_dlg',{
2 title : 'This is just a example title'
3});