[pLog-svn] r7087 - in plog/branches/lifetype-1.2/js/tinymce/plugins: . embed embed/img embed/js embed/langs

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Fri Dec 17 12:25:11 EST 2010


Author: jondaley
Date: 2010-12-17 12:25:11 -0500 (Fri, 17 Dec 2010)
New Revision: 7087

Added:
   plog/branches/lifetype-1.2/js/tinymce/plugins/embed/
   plog/branches/lifetype-1.2/js/tinymce/plugins/embed/dialog.htm
   plog/branches/lifetype-1.2/js/tinymce/plugins/embed/editor_plugin_src.js
   plog/branches/lifetype-1.2/js/tinymce/plugins/embed/img/
   plog/branches/lifetype-1.2/js/tinymce/plugins/embed/img/embed.gif
   plog/branches/lifetype-1.2/js/tinymce/plugins/embed/js/
   plog/branches/lifetype-1.2/js/tinymce/plugins/embed/js/dialog.js
   plog/branches/lifetype-1.2/js/tinymce/plugins/embed/langs/
   plog/branches/lifetype-1.2/js/tinymce/plugins/embed/langs/en.js
   plog/branches/lifetype-1.2/js/tinymce/plugins/embed/langs/en_dlg.js
Log:
new embed plugin that can be used for videos, etc.  From tinymce's sourceforge page, courtesy of http://www.chilipepperdesign.com

Added: plog/branches/lifetype-1.2/js/tinymce/plugins/embed/dialog.htm
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/plugins/embed/dialog.htm	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/plugins/embed/dialog.htm	2010-12-17 17:25:11 UTC (rev 7087)
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<title>{#embed_dlg.title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="js/dialog.js"></script>
+</head>
+<body>
+
+<form onsubmit="EmbedDialog.insert();return false;" action="#">
+	<fieldset>
+		<legend>{#embed_dlg.tabone}</legend>
+		<p>Paste embed code here <br />(youTube, Picasa, Vimeo, etc):</p>
+		<p><textarea rows="8" cols="50" id="embedcode" name="embedcode" type="text" class="text"></textarea></p>
+	</fieldset>
+
+	<div class="mceActionPanel">
+		<div style="float: left">
+			<input type="button" id="insert" name="insert" value="{#insert}" onclick="EmbedDialog.insert();" />
+		</div>
+
+		<div style="float: right">
+			<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+		</div>
+	</div>
+</form>
+
+</body>
+</html>

Added: plog/branches/lifetype-1.2/js/tinymce/plugins/embed/editor_plugin_src.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/plugins/embed/editor_plugin_src.js	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/plugins/embed/editor_plugin_src.js	2010-12-17 17:25:11 UTC (rev 7087)
@@ -0,0 +1,88 @@
+/**
+ * editor_plugin_src.js
+ * 
+ *  This plugin allows users to insert Embed codes (or any other HTML they want) at their curor location.
+ *
+ * Author: http://www.chilipepperdesign.com
+ * Based on the Example Plugin
+ * 
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+	// Load plugin specific language pack
+	tinymce.PluginManager.requireLangPack('embed');
+
+	tinymce.create('tinymce.plugins.EmbedPlugin', {
+		/**
+		 * Initializes the plugin, this will be executed after the plugin has been created.
+		 * This call is done before the editor instance has finished it's initialization so use the onInit event
+		 * of the editor instance to intercept that event.
+		 *
+		 * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
+		 * @param {string} url Absolute URL to where the plugin is located.
+		 */
+		init : function(ed, url) {
+			// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
+			ed.addCommand('mceEmbed', function() {
+				ed.windowManager.open({
+					file : url + '/dialog.htm',
+					width : 305 + parseInt(ed.getLang('embed.delta_width', 0)),
+					height : 250 + parseInt(ed.getLang('embed.delta_height', 0)),
+					inline : 1
+				}, {
+					plugin_url : url // Plugin absolute URL
+				});
+			});
+
+			// Register embed button
+			ed.addButton('embed', {
+				title : 'embed.desc',
+				cmd : 'mceEmbed',
+				image : url + '/img/embed.gif'
+			});
+
+			// Add a node change handler, selects the button in the UI when a image is selected
+			ed.onNodeChange.add(function(ed, cm, n) {
+				cm.setActive('embed', n.nodeName == 'IMG');
+			});
+		},
+
+		/**
+		 * Creates control instances based in the incomming name. This method is normally not
+		 * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
+		 * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
+		 * method can be used to create those.
+		 *
+		 * @param {String} n Name of the control to create.
+		 * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
+		 * @return {tinymce.ui.Control} New control instance or null if no control was created.
+		 */
+		createControl : function(n, cm) {
+			return null;
+		},
+
+		/**
+		 * Returns information about the plugin as a name/value array.
+		 * The current keys are longname, author, authorurl, infourl and version.
+		 *
+		 * @return {Object} Name/value array containing information about the plugin.
+		 */
+		getInfo : function() {
+			return {
+				longname : 'Embed plugin',
+				author : 'Chili Pepper Design',
+				authorurl : 'http://www.chilipepperdesign.com',
+				infourl : 'http://www.chilipepperdesign.com',
+				version : '1.0'
+			};
+		}
+	});
+
+	// Register plugin
+	tinymce.PluginManager.add('embed', tinymce.plugins.EmbedPlugin);
+})();

Added: plog/branches/lifetype-1.2/js/tinymce/plugins/embed/img/embed.gif
===================================================================
(Binary files differ)


Property changes on: plog/branches/lifetype-1.2/js/tinymce/plugins/embed/img/embed.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: plog/branches/lifetype-1.2/js/tinymce/plugins/embed/js/dialog.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/plugins/embed/js/dialog.js	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/plugins/embed/js/dialog.js	2010-12-17 17:25:11 UTC (rev 7087)
@@ -0,0 +1,18 @@
+tinyMCEPopup.requireLangPack();
+
+var EmbedDialog = {
+	init : function() {
+		var f = document.forms[0];
+
+		// Get the selected contents as text and place it in the input
+		f.embedcode.value = tinyMCEPopup.editor.selection.getContent({format : 'html'});
+	},
+
+	insert : function() {
+		// Insert the contents from the input into the document
+		tinyMCEPopup.editor.execCommand('mceInsertContent', false, document.forms[0].embedcode.value);
+		tinyMCEPopup.close();
+	}
+};
+
+tinyMCEPopup.onInit.add(EmbedDialog.init, EmbedDialog);

Added: plog/branches/lifetype-1.2/js/tinymce/plugins/embed/langs/en.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/plugins/embed/langs/en.js	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/plugins/embed/langs/en.js	2010-12-17 17:25:11 UTC (rev 7087)
@@ -0,0 +1,3 @@
+tinyMCE.addI18n('en.embed',{
+	desc : 'Insert Embed Code'
+});

Added: plog/branches/lifetype-1.2/js/tinymce/plugins/embed/langs/en_dlg.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/plugins/embed/langs/en_dlg.js	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/plugins/embed/langs/en_dlg.js	2010-12-17 17:25:11 UTC (rev 7087)
@@ -0,0 +1,4 @@
+tinyMCE.addI18n('en.embed_dlg',{
+	title : 'Insert Embed Code',
+	tabone : 'Insert Embed Code'
+});



More information about the pLog-svn mailing list