MDL-19184 more tinymce integration and upgrade related improvements

This commit is contained in:
skodak 2009-05-17 07:47:04 +00:00
parent a4e6818ab3
commit 958d3f1e2c
3 changed files with 74 additions and 54 deletions

View File

@ -1,54 +1,50 @@
Index: tinymce/plugins/media/js/media.js
Index: lib/editor/tinymce/plugins/media/js/media.js
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/editor/tinymce/plugins/media/js/media.js,v
retrieving revision 1.3
diff -u -r1.3 media.js
--- tiny_mce/plugins/media/js/media.js 23 Sep 2008 04:10:42 -0000 1.3
+++ tiny_mce/plugins/media/js/media.js 25 Nov 2008 10:39:39 -0000
@@ -263,6 +263,11 @@
h += ' />';
+ var is_youtube = repo_hook(f.src.value);
+ if (is_youtube) {
retrieving revision 1.1
diff -u -r1.1 media.js
--- lib/editor/tinymce/plugins/media/js/media.js 16 May 2009 20:54:41 -0000 1.1
+++ lib/editor/tinymce/plugins/media/js/media.js 17 May 2009 07:44:27 -0000
@@ -263,6 +263,13 @@
h += ' />';
+ var is_youtube = repo_hook(f.src.value);
+ if (is_youtube) {
+ var re = new RegExp("v\/(.+)\#(.+)", "i");
+ var result = f.src.value.match(re);
+ h = '<a href="'+f.src.value+'">'+result[2]+'</a>';
+ }
+
ed.execCommand('mceInsertContent', false, h);
}
@@ -305,12 +310,14 @@
fo = ed.getParam("media_types", "flash=swf;flv=flv;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';');
// YouTube
- if (v.match(/watch\?v=(.+)(.*)/)) {
+ if (v.match(/watch\?v=(.+)(.*)/)) {
f.width.value = '425';
f.height.value = '350';
- }
+ } else if (v.match(/v\/(.+)(.*)/)) {
+ f.width.value = '425';
+ f.height.value = '350';
+ return 'flash';
+ }
// Google video
if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) {
@@ -625,4 +632,15 @@
p.innerHTML = "<!-- x --->" + h;
}
+function repo_hook(url){
+ var f = document.forms[0];
+ if (url.match(/v\/(.+)(.*)/)) {
+ f.width.value = '425';
+ f.height.value = '350';
+ return true;
+ } else {
+ return false;
+ }
+}
+
tinyMCEPopup.onInit.add(init);
+ }
+
ed.execCommand('mceInsertContent', false, h);
}
@@ -310,7 +317,11 @@
f.height.value = '350';
f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1];
return 'flash';
- }
+ } else if (v.match(/v\/(.+)(.*)/)) {
+ f.width.value = '425';
+ f.height.value = '350';
+ return 'flash';
+ }
// Google video
if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) {
@@ -627,4 +638,15 @@
p.innerHTML = "<!-- x --->" + h;
}
+function repo_hook(url){
+ var f = document.forms[0];
+ if (url.match(/v\/(.+)(.*)/)) {
+ f.width.value = '425';
+ f.height.value = '350';
+ return true;
+ } else {
+ return false;
+ }
+}
+
tinyMCEPopup.onInit.add(init);

View File

@ -263,6 +263,13 @@ function insertMedia() {
h += ' />';
var is_youtube = repo_hook(f.src.value);
if (is_youtube) {
var re = new RegExp("v\/(.+)\#(.+)", "i");
var result = f.src.value.match(re);
h = '<a href="'+f.src.value+'">'+result[2]+'</a>';
}
ed.execCommand('mceInsertContent', false, h);
}
@ -310,7 +317,11 @@ function getType(v) {
f.height.value = '350';
f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1];
return 'flash';
}
} else if (v.match(/v\/(.+)(.*)/)) {
f.width.value = '425';
f.height.value = '350';
return 'flash';
}
// Google video
if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) {
@ -627,4 +638,15 @@ function generatePreview(c) {
p.innerHTML = "<!-- x --->" + h;
}
function repo_hook(url){
var f = document.forms[0];
if (url.match(/v\/(.+)(.*)/)) {
f.width.value = '425';
f.height.value = '350';
return true;
} else {
return false;
}
}
tinyMCEPopup.onInit.add(init);

View File

@ -8,12 +8,14 @@ Upgrade procedure:
1/ Download latest dev package from http://tinymce.moxiecode.com/download.php
2/ replace tiny_mce*.* files, themes/*, utils/* and plugins/* (keep dragmath, moodlenolink, spellchecker)
3/ copy tinymce/jscripts/tiny_mce/classes/Popup.js to Popup.js
4/ apply patches
5/ compress modified js files using yuicompressor.jar from dev package, use shell file extra/tools/compress.sh
6/ download all TinyMCE lang files and update moodle lang string files
4/ apply plugins/media/* (extra/tinymce_plugin_media.patch) - MDL-16650
5/ apply strings patch
6/ compress modified js files using yuicompressor.jar from dev package, use shell file extra/tools/compress.sh
7/ download all TinyMCE lang files and update moodle lang string files
8/ rebuild string files
TODO:
* apply plugins/media/* (extra/tinymce_plugin_media.patch) - MDL-16650
* lang string handling
* customize spellchecker
* finish update with info from http://docs.moodle.org/en/Development:TinyMCE_Upgrade