Skip to content

Commit

Permalink
refs #1655 , #1666 : Modified - editor usability
Browse files Browse the repository at this point in the history
 - Moodified : Editor design
 - BUGFIX : Unnecessary code inserted when attaching non-media files
 - BUGFIX : save - preview button covers toolbar action.
 - BUGFIX : file attach TTML-html conversion break TTML properties.
  • Loading branch information
inureyes committed Mar 13, 2014
1 parent 90fa1a4 commit 35b2d98
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 80 deletions.
2 changes: 1 addition & 1 deletion plugins/ED_tinyMCE/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function tinyMCE_editorinit($editor) {
plugins: [
"TTMLsupport advlist autolink link image lists charmap print hr anchor pagebreak table",
"searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
"table contextmenu directionality emoticons textcolor paste textcolor"
"table contextmenu directionality emoticons textcolor paste textcolor autoresize"
],

toolbar1: "tcsave print | bold italic underline strikethrough | styleselect formatselect fontselect fontsizeselect forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent blockquote hr tcmoreless",
Expand Down
111 changes: 59 additions & 52 deletions plugins/ED_tinyMCE/override.css
Original file line number Diff line number Diff line change
@@ -1,79 +1,86 @@
@charset "utf-8";
@charset utf-8;
/* This stylesheet overrides administration panel skin, to make uploader section float. */
.mce-toolbar-grp{
position : fixed !important;
height : 30px !important;
z-index : 100;
.mce-toolbar-grp {
position:fixed!important;
height:30px!important;
z-index:100;
top:80px;
left:175px;
background-color : #fff !important;
display:block !important;
border:0 !important;
background:#fff !important;
background-color:#fff!important;
display:block!important;
border:0!important;
background:#fff!important;
}

.mce-fullscreen {
z-index:2000 !important;
z-index:2000!important;
}

.mce-container {
margin-left:auto !important;
margin-right:auto !important;
margin-left:auto!important;
margin-right:auto!important;
}

.mce-stack-layout {
box-shadow:none!important;
}

.mce-container-body {
background-color:#fff !important;
background-color:#fff!important;
}

.mce-edit-area {
margin:20px !important;
border:1px #eee dashed !important;
}
.mce-flow-layout {
/* background-color:#f6f6f6 !important;*/
padding:20px!important;
box-shadow:0 0 5px rgba(0,0,0,0.3);
border:1px #eee solid!important;
}

#textarea-section {
background-color: transparent !important;
}
#status-container {
display:none;
background-color:transparent!important;
}

#save-section {
position: fixed !important;
top: 35px;
right:15px;
z-index:100;
position:fixed!important;
top:32px;
height:20px!important;
right:15px;
z-index:100;
}

#save-section .button-box input {
height:25px !important;
line-height:25px !important;
height:20px!important;
line-height:20px!important;
}
#save-section .button-box .save-button,
#save-section .button-box .list-button {
display: none;

#saveAndReturnButton {
background-image:linear-gradient(top, #333, #f33)!important;
}

#upload-section {
background-color : #FFF;
margin : 10px 20px 10px 0;
display:none;
position:fixed;
z-index:140;
border-top:1px solid #bbb;
background-color:#FFF;
margin:10px 20px 10px 0;
display:none;
position:fixed;
z-index:140;
border-top:1px solid #bbb;
top:100%;
bottom:10px;
bottom:10px;
left:50%;
margin-top:-200px;
margin-left:-370px;
border: 1px solid #F2F2F2;
width:900px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
-moz-box-shadow: 0 0 10px rgba(0,0,0,0.3);
-webkit-box-shadow: 0 0 10px rgba(0,0,0,0.3);
box-shadow: 0 0 10px rgba(0,0,0,0.3);
border:1px solid #F2F2F2;
width:900px;
border-radius:3px;
box-shadow:0 0 10px rgba(0,0,0,0.3);
}
#insert-container
{
position : absolute;
top : 10px;
left : 685px;
width : 100px;

#insert-container {
position:absolute;
top:10px;
left:685px;
width:100px;
}

#status-container,#save-section .button-box .save-button,#save-section .button-box .list-button {
display:none;
}
29 changes: 15 additions & 14 deletions plugins/ED_tinyMCE/tinymce/plugins/TTMLsupport/plugin.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Textcube editor support for tinyMCE 4
* Version 2.0.0.140306
* Version 2.1.0.20140313
*
* Created : May 30, 2011
* Last modified : Mar 6, 2014
* Last modified : Mar 13, 2014
*
* Copyright 2011, 2014 Jeongkyu Shin <[email protected]>
* Released under LGPL License.
Expand Down Expand Up @@ -1568,29 +1568,30 @@ tinymce.create('tinymce.Textcube.TTMLsupport', {
addObject : function(data) {
var t = this;
var objects = data.objects;

switch (data.mode) {
case 'Image1L': case 'Image1C': case 'Image1R':
if (t._isMediaFile(objects[0][0])) {
getObject(t.id + "propertyInsertObject_type").value = "url";
getObject(t.id + "propertyInsertObject_type").value = "url";
getObject(t.id + "propertyInsertObject_url").value = blogURL + "/attachment/" + objects[0][0];
t.command("InsertObject");
return true;
}
// *fall through*
} else {

}
// *fall through*
case 'Image2C': case 'Image3C':
try {
var src = servicePath + adminSkin + "/image/spacer.gif";
var moreattrs = '';
var longdesc;
if (data.mode == 'Image1L' || data.mode == 'Image1C' || data.mode == 'Image1R') {
if (new RegExp("\.(jpe?g|gif|png|bmp)$", "i").test(objects[0][0])) {
if (new RegExp("\.(jpe?g|gif|png|bmp|webm|svg)$", "i").test(objects[0][0])) {
src = t.propertyFilePath + objects[0][0];
moreattrs = objects[0][1];
} else {
objects[0][1] = t.styleUnknown;
objects[0][1] = '';
moreattrs = t.styleUnknown;
}
moreattrs = objects[0][1];
longdesc = data.mode.substr(5) + '|' + objects[0][0] + '|' + objects[0][1] + '|' + objects[0][2].replaceAll("|", "");
} else {
moreattrs = 'width="' + (parseInt(data.mode.substr(5)) * 100) + '" height="100"';
Expand All @@ -1603,7 +1604,7 @@ tinymce.create('tinymce.Textcube.TTMLsupport', {
var className = {Image1L: 'tatterImageLeft', Image1C: 'tatterImageCenter', Image1R: 'tatterImageRight',
Image2C: 'tatterImageDual', Image3C: 'tatterImageTriple'}[data.mode];
var prefix = '<img class="' + className + '" src="' + src + '" ' + moreattrs + ' longdesc="' + t.addQuot(longdesc) + '" />';
t.command("Raw", prefix);
t.command("Raw", prefix);
return true;
} catch(e) { }

Expand All @@ -1615,6 +1616,7 @@ tinymce.create('tinymce.Textcube.TTMLsupport', {
return true;

case 'ImageFree':

var prefix = '';
for (var i = 0; objects[i]; ++i) {
prefix += '<img class="tatterImageFree" src="' + t.propertyFilePath + objects[i][0] + '" longdesc="[##_ATTACH_PATH_##]/' + objects[i][0] + '" ' + objects[i][1] + ' />';
Expand Down Expand Up @@ -1642,12 +1644,12 @@ tinymce.create('tinymce.Textcube.TTMLsupport', {
//insertTag(t.textarea, '[##_' + code + '_##]', '');
return true;
}

return false;
},
command : function(command, value1, value2) {
var t = this;
switch(command) {

switch(command) {
case "MoreLessBlock":
t.command("Raw", '<div class="tattermoreless" more=" more.. " less=" less.. ">&nbsp;', "</div>");
break;
Expand Down Expand Up @@ -1691,7 +1693,6 @@ tinymce.create('tinymce.Textcube.TTMLsupport', {
case "wm": type = "video/x-ms-wm"; break;
case "wvx": type = "video/x-ms-wvx"; break;
}

if(type === null) {
alert(s_unknownFileType);
return;
Expand Down Expand Up @@ -1753,7 +1754,7 @@ tinymce.create('tinymce.Textcube.TTMLsupport', {
author : 'Jeongkyu Shin',
authorurl : 'http://www.textcube.org',
infourl : 'http://dev.textcube.org',
version : "2.0"
version : "2.1"
};
}
});
Expand Down

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions plugins/FM_Modern/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ TTModernEditor.prototype.initialize = function(textarea) {
this.textarea = textarea;
if(this.editMode == "WYSIWYG")
this.textarea.style.display = "none";

// 디자인모드의 IFRAME을 생성한다
this.iframe = document.createElement("iframe");
this.iframe.id = "tatterVisualEditor";
Expand Down Expand Up @@ -167,7 +167,7 @@ TTModernEditor.prototype.initialize = function(textarea) {
// Changing to browser desingmode.
try { this.contentDocument.designMode = "on"; }
catch(e) { return; }

// IFRAME 안에 HTML을 작성한다
// Put HTML code into IFRAME
this.contentDocument.open("text/html", "replace");
Expand All @@ -193,7 +193,7 @@ TTModernEditor.prototype.initialize = function(textarea) {
// Connect event handlers occurring in IFRAME
STD.addEventListener(this.contentDocument);
var eventHandler = function(event) { _this.eventHandler(event); };

this.contentDocument.addEventListener("mousedown", eventHandler, false);
this.contentDocument.addEventListener("mouseup", eventHandler, false);
this.contentDocument.addEventListener("keydown", eventHandler, false);
Expand All @@ -202,7 +202,7 @@ TTModernEditor.prototype.initialize = function(textarea) {
this.contentDocument.addEventListener("keyup", eventHandler, false);

this.lastSelectionRange = null;

// editor height resize event
var target = (this.editMode == "WYSIWYG" ? this.iframe : textarea);
this.resizer = new TTEditorResizer(target, getObject('status-container'), [document, this.contentDocument]);
Expand Down Expand Up @@ -231,7 +231,7 @@ TTModernEditor.prototype.initialize = function(textarea) {
var scrollEventHandler = function() { _this.setPropertyPosition(); return true; };
this.scrollEventHandler_bounded = scrollEventHandler;
window.addEventListener("scroll", scrollEventHandler, false);

if(this.editMode == "TEXTAREA")
this.iframe.style.display = "none";
// 데이터 싱크 과정.
Expand Down Expand Up @@ -370,7 +370,7 @@ TTModernEditor.prototype.ttml2html = function() {

str = str.replaceAll(search, replace);
}

// iMazing 처리
var regImazing = new RegExp("\\[##_iMazing\\|(.*?)_##\\]", "");
while(result = regImazing.exec(str)) {
Expand Down Expand Up @@ -1640,7 +1640,7 @@ TTModernEditor.prototype.eventHandler = function(event) {
break;
case "keypress":
var range = this.getSelectionRange();
if(event.keyCode == 13) {
if(event.keyCode == 13) {
if(this.newLineToParagraph) {
if(STD.isFirefox && !event.shiftKey) {
// TODO : test<br /> -> <p>test</p>
Expand Down Expand Up @@ -2209,12 +2209,13 @@ TTModernEditor.prototype.addObject = function(data) {
var moreattrs = '';
var longdesc;
if (data.mode == 'Image1L' || data.mode == 'Image1C' || data.mode == 'Image1R') {
if (new RegExp("\.(jpe?g|gif|png|bmp)$", "i").test(objects[0][0])) {
if (new RegExp("\.(jpe?g|gif|png|bmp|webm|svg)$", "i").test(objects[0][0])) {
src = this.propertyFilePath + objects[0][0];
moreattrs = objects[0][1];
} else {
objects[0][1] = this.styleUnknown;
objects[0][1] = '';
moreattrs = this.styleUnknown;
}
moreattrs = objects[0][1];
longdesc = data.mode.substr(5) + '|' + objects[0][0] + '|' + objects[0][1] + '|' + objects[0][2].replaceAll("|", "");
} else {
moreattrs = 'width="' + (parseInt(data.mode.substr(5)) * 100) + '" height="100"';
Expand Down Expand Up @@ -2408,7 +2409,7 @@ TTModernEditor.prototype.getEditorPalette = function(htmlonly) {
}
html = html.replace(new RegExp('__EDITOR__', 'g'), 'TTModernEditor.editors.' + this.name);
html = html.replace(new RegExp('__ID__', 'g'), this.id);

if(htmlonly == true) {
return '<div id="moderneditor-palette">'+html+'</div>';
}
Expand Down Expand Up @@ -3013,4 +3014,3 @@ TTModernEditor.prototype.changeButtonStatus = function(obj, palette) {
}
}
}

0 comments on commit 35b2d98

Please sign in to comment.