smart_editor 0.0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/smart_editor/application.js +15 -0
- data/app/assets/javascripts/smart_editor/editor_images.js +1 -0
- data/app/assets/stylesheets/smart_editor/application.css +13 -0
- data/app/assets/stylesheets/smart_editor/editor_images.css +4 -0
- data/app/controllers/smart_editor/application_controller.rb +4 -0
- data/app/controllers/smart_editor/editor_images_controller.rb +41 -0
- data/app/helpers/smart_editor/application_helper.rb +4 -0
- data/app/helpers/smart_editor/editor_images_helper.rb +4 -0
- data/app/models/smart_editor/editor_image.rb +7 -0
- data/app/uploaders/file_uploader.rb +55 -0
- data/app/views/layouts/smart_editor/application.html.erb +14 -0
- data/app/views/smart_editor/editor_images/index.html.erb +4 -0
- data/config/routes.rb +7 -0
- data/db/migrate/20130101074444_create_smart_editor_editor_images.rb +10 -0
- data/lib/generators/smart_editor/smart_editor_generator.rb +18 -0
- data/lib/generators/smart_editor/templates/public/smart_editor/SmartEditor2Skin.html +635 -0
- data/lib/generators/smart_editor/templates/public/smart_editor/popup/quick_photo/FileUploader.php +22 -0
- data/lib/generators/smart_editor/templates/public/smart_editor/popup/quick_photo/FileUploader_html5.php +25 -0
- data/lib/generators/smart_editor/templates/public/smart_editor/popup/quick_photo/Photo_Quick_UploadPopup.html +100 -0
- data/lib/generators/smart_editor/templates/public/smart_editor/popup/quick_photo/QuickPhotoPopup.js +675 -0
- data/lib/generators/smart_editor/templates/public/smart_editor/popup/quick_photo/callback.html +32 -0
- data/lib/generators/smart_editor/templates/public/smart_editor/popup/quick_photo/jindo.min.js +12686 -0
- data/lib/generators/smart_editor/templates/public/smart_editor/popup/quick_photo/jindo_fileUpload.js +390 -0
- data/lib/generators/smart_editor/templates/public/smart_editor/smart_editor2_inputarea.html +9 -0
- data/lib/generators/smart_editor/templates/public/smart_editor/smart_editor2_inputarea_ie8.html +10 -0
- data/lib/smart_editor/class_methods.rb +10 -0
- data/lib/smart_editor/engine.rb +5 -0
- data/lib/smart_editor/form_builder.rb +11 -0
- data/lib/smart_editor/version.rb +3 -0
- data/lib/smart_editor.rb +18 -0
- data/lib/tasks/smart_editor_tasks.rake +4 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +16 -0
- data/test/dummy/app/assets/javascripts/posts.js +2 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/assets/stylesheets/posts.css +4 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/posts_controller.rb +85 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/posts_helper.rb +2 -0
- data/test/dummy/app/models/post.rb +4 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/posts/_form.html.erb +30 -0
- data/test/dummy/app/views/posts/edit.html.erb +6 -0
- data/test/dummy/app/views/posts/index.html.erb +27 -0
- data/test/dummy/app/views/posts/new.html.erb +5 -0
- data/test/dummy/app/views/posts/show.html.erb +20 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +7 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20130103085542_create_posts.rb +11 -0
- data/test/dummy/db/migrate/20130103090021_create_smart_editor_editor_images.smart_editor.rb +11 -0
- data/test/dummy/db/schema.rb +32 -0
- data/test/dummy/log/development.log +713 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/smart_editor/SmartEditor2Skin.html +635 -0
- data/test/dummy/public/smart_editor/popup/quick_photo/FileUploader.php +22 -0
- data/test/dummy/public/smart_editor/popup/quick_photo/FileUploader_html5.php +25 -0
- data/test/dummy/public/smart_editor/popup/quick_photo/Photo_Quick_UploadPopup.html +100 -0
- data/test/dummy/public/smart_editor/popup/quick_photo/QuickPhotoPopup.js +675 -0
- data/test/dummy/public/smart_editor/popup/quick_photo/callback.html +32 -0
- data/test/dummy/public/smart_editor/popup/quick_photo/jindo.min.js +12686 -0
- data/test/dummy/public/smart_editor/popup/quick_photo/jindo_fileUpload.js +390 -0
- data/test/dummy/public/smart_editor/smart_editor2_inputarea.html +9 -0
- data/test/dummy/public/smart_editor/smart_editor2_inputarea_ie8.html +10 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/fixtures/posts.yml +11 -0
- data/test/dummy/test/functional/posts_controller_test.rb +49 -0
- data/test/dummy/test/unit/helpers/posts_helper_test.rb +4 -0
- data/test/dummy/test/unit/post_test.rb +7 -0
- data/test/dummy/tmp/cache/assets/C39/A20/sprockets%2Fd75302feb7958c52568020a888775667 +0 -0
- data/test/dummy/tmp/cache/assets/C8B/9F0/sprockets%2F42090f88c5061f72460d7c83a9bc8990 +0 -0
- data/test/dummy/tmp/cache/assets/C8E/A60/sprockets%2F74b1945f4d4a322ab567f73798c32838 +0 -0
- data/test/dummy/tmp/cache/assets/CD4/040/sprockets%2F7c241e3470f7210ab843c109c9d68a4b +0 -0
- data/test/dummy/tmp/cache/assets/CE3/740/sprockets%2F200278c67b4dde839345d7b018fed561 +0 -0
- data/test/dummy/tmp/cache/assets/CEE/680/sprockets%2F6d653ad72aed952816dd79e63c761417 +0 -0
- data/test/dummy/tmp/cache/assets/D12/CA0/sprockets%2Fcd507925f6bb1f62170d028ca668ad98 +0 -0
- data/test/dummy/tmp/cache/assets/D13/8A0/sprockets%2Fec89fa303e9609b18f50b6de2831433e +0 -0
- data/test/dummy/tmp/cache/assets/D6F/A80/sprockets%2F8893ca0d5d16eb3d85c0964bdbbe3381 +0 -0
- data/test/dummy/tmp/cache/assets/D86/AF0/sprockets%2Fcfa5f1244012fcd263cee551afe412b2 +0 -0
- data/test/dummy/tmp/cache/assets/D92/5A0/sprockets%2Fb0e45a13b900ecbf7011b78bdff2595e +0 -0
- data/test/dummy/tmp/cache/assets/D9D/950/sprockets%2F65093fff17b1aa3bed7e0dda53563b79 +0 -0
- data/test/dummy/tmp/cache/assets/DF9/8C0/sprockets%2Fc27a71cbee6a5dffdc2534b267b2fa66 +0 -0
- data/test/dummy/tmp/cache/assets/E54/F60/sprockets%2Ff1bba5cc065ebbb83addfbba59f82059 +0 -0
- data/test/fixtures/smart_editor/editor_images.yml +11 -0
- data/test/functional/smart_editor/editor_images_controller_test.rb +9 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/smart_editor_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- data/test/unit/helpers/smart_editor/editor_images_helper_test.rb +6 -0
- data/test/unit/smart_editor/editor_image_test.rb +9 -0
- data/vendor/assets/images/smart_editor/bg_b1.png +0 -0
- data/vendor/assets/images/smart_editor/bg_find_h3.gif +0 -0
- data/vendor/assets/images/smart_editor/bg_line1.gif +0 -0
- data/vendor/assets/images/smart_editor/bg_quote2.gif +0 -0
- data/vendor/assets/images/smart_editor/bg_set.gif +0 -0
- data/vendor/assets/images/smart_editor/bg_tool2.gif +0 -0
- data/vendor/assets/images/smart_editor/btn_set.png +0 -0
- data/vendor/assets/images/smart_editor/bx_set_110302.gif +0 -0
- data/vendor/assets/images/smart_editor/editor_guideline_698.gif +0 -0
- data/vendor/assets/images/smart_editor/editor_guideline_890.gif +0 -0
- data/vendor/assets/images/smart_editor/icon_set.gif +0 -0
- data/vendor/assets/images/smart_editor/photoQuickPopup/bg_drag_image.png +0 -0
- data/vendor/assets/images/smart_editor/photoQuickPopup/btn_cancel.png +0 -0
- data/vendor/assets/images/smart_editor/photoQuickPopup/btn_confirm.png +0 -0
- data/vendor/assets/images/smart_editor/photoQuickPopup/btn_confirm2.png +0 -0
- data/vendor/assets/images/smart_editor/photoQuickPopup/btn_del.png +0 -0
- data/vendor/assets/images/smart_editor/photoQuickPopup/btn_find.png +0 -0
- data/vendor/assets/images/smart_editor/text_tool_set.png +0 -0
- data/vendor/assets/images/smart_editor/text_tool_set2.png +0 -0
- data/vendor/assets/javascripts/smart_editor/HuskyEZCreator.js +133 -0
- data/vendor/assets/javascripts/smart_editor/SE2B_Configuration.js +77 -0
- data/vendor/assets/javascripts/smart_editor/SE2BasicCreator.js +85 -0
- data/vendor/assets/javascripts/smart_editor/hp_SE2M_AttachQuickPhoto.js +106 -0
- data/vendor/assets/javascripts/smart_editor/jindo.min.js +12699 -0
- data/vendor/assets/javascripts/smart_editor/jindo_component.js +279 -0
- data/vendor/assets/javascripts/smart_editor/loader-min.js +120 -0
- data/vendor/assets/javascripts/smart_editor.js +21 -0
- data/vendor/assets/stylesheets/smart_editor/smart_editor2.css +262 -0
- data/vendor/assets/stylesheets/smart_editor/smart_editor2_in.css +20 -0
- data/vendor/assets/stylesheets/smart_editor/smart_editor2_items.css +454 -0
- data/vendor/assets/stylesheets/smart_editor/smart_editor2_out.css +24 -0
- metadata +331 -0
@@ -0,0 +1,133 @@
|
|
1
|
+
if(typeof window.nhn=='undefined') window.nhn = {};
|
2
|
+
if (!nhn.husky) nhn.husky = {};
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @fileOverview This file contains application creation helper function, which would load up an HTML(Skin) file and then execute a specified create function.
|
6
|
+
* @name HuskyEZCreator.js
|
7
|
+
*/
|
8
|
+
nhn.husky.EZCreator = new (function(){
|
9
|
+
this.nBlockerCount = 0;
|
10
|
+
|
11
|
+
this.createInIFrame = function(htOptions){
|
12
|
+
if(arguments.length == 1){
|
13
|
+
var oAppRef = htOptions.oAppRef;
|
14
|
+
var elPlaceHolder = htOptions.elPlaceHolder;
|
15
|
+
var sSkinURI = htOptions.sSkinURI;
|
16
|
+
var fCreator = htOptions.fCreator;
|
17
|
+
var fOnAppLoad = htOptions.fOnAppLoad;
|
18
|
+
var bUseBlocker = htOptions.bUseBlocker;
|
19
|
+
var htParams = htOptions.htParams || null;
|
20
|
+
}else{
|
21
|
+
// for backward compatibility only
|
22
|
+
var oAppRef = arguments[0];
|
23
|
+
var elPlaceHolder = arguments[1];
|
24
|
+
var sSkinURI = arguments[2];
|
25
|
+
var fCreator = arguments[3];
|
26
|
+
var fOnAppLoad = arguments[4];
|
27
|
+
var bUseBlocker = arguments[5];
|
28
|
+
var htParams = arguments[6];
|
29
|
+
}
|
30
|
+
|
31
|
+
if(bUseBlocker) nhn.husky.EZCreator.showBlocker();
|
32
|
+
|
33
|
+
var attachEvent = function(elNode, sEvent, fHandler){
|
34
|
+
if(elNode.addEventListener){
|
35
|
+
elNode.addEventListener(sEvent, fHandler, false);
|
36
|
+
}else{
|
37
|
+
elNode.attachEvent("on"+sEvent, fHandler);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
if(!elPlaceHolder){
|
42
|
+
alert("Placeholder is required!");
|
43
|
+
return;
|
44
|
+
}
|
45
|
+
|
46
|
+
if(typeof(elPlaceHolder) != "object")
|
47
|
+
elPlaceHolder = document.getElementById(elPlaceHolder);
|
48
|
+
|
49
|
+
var elIFrame, nEditorWidth, nEditorHeight;
|
50
|
+
|
51
|
+
|
52
|
+
try{
|
53
|
+
elIFrame = document.createElement("<IFRAME frameborder=0 scrolling=no>");
|
54
|
+
}catch(e){
|
55
|
+
elIFrame = document.createElement("IFRAME");
|
56
|
+
elIFrame.setAttribute("frameborder", "0");
|
57
|
+
elIFrame.setAttribute("scrolling", "no");
|
58
|
+
}
|
59
|
+
|
60
|
+
elIFrame.style.width = "1px";
|
61
|
+
elIFrame.style.height = "1px";
|
62
|
+
elPlaceHolder.parentNode.insertBefore(elIFrame, elPlaceHolder.nextSibling);
|
63
|
+
|
64
|
+
attachEvent(elIFrame, "load", function(){
|
65
|
+
fCreator = elIFrame.contentWindow[fCreator] || elIFrame.contentWindow.createSEditor2;
|
66
|
+
|
67
|
+
// top.document.title = ((new Date())-window.STime);
|
68
|
+
// window.STime = new Date();
|
69
|
+
|
70
|
+
try{
|
71
|
+
|
72
|
+
nEditorWidth = elIFrame.contentWindow.document.body.scrollWidth || "500px";
|
73
|
+
nEditorHeight = elIFrame.contentWindow.document.body.scrollHeight + 12;
|
74
|
+
elIFrame.style.width = "100%";
|
75
|
+
elIFrame.style.height = nEditorHeight+ "px";
|
76
|
+
elIFrame.contentWindow.document.body.style.margin = "0";
|
77
|
+
}catch(e){
|
78
|
+
nhn.husky.EZCreator.hideBlocker(true);
|
79
|
+
elIFrame.style.border = "5px solid red";
|
80
|
+
elIFrame.style.width = "500px";
|
81
|
+
elIFrame.style.height = "500px";
|
82
|
+
alert("Failed to access "+sSkinURI);
|
83
|
+
return;
|
84
|
+
}
|
85
|
+
|
86
|
+
var oApp = fCreator(elPlaceHolder, htParams); // oEditor
|
87
|
+
|
88
|
+
|
89
|
+
oApp.elPlaceHolder = elPlaceHolder;
|
90
|
+
|
91
|
+
oAppRef[oAppRef.length] = oApp;
|
92
|
+
if(!oAppRef.getById) oAppRef.getById = {};
|
93
|
+
|
94
|
+
if(elPlaceHolder.id) oAppRef.getById[elPlaceHolder.id] = oApp;
|
95
|
+
|
96
|
+
oApp.run({fnOnAppReady:fOnAppLoad});
|
97
|
+
|
98
|
+
// top.document.title += ", "+((new Date())-window.STime);
|
99
|
+
nhn.husky.EZCreator.hideBlocker();
|
100
|
+
});
|
101
|
+
// window.STime = new Date();
|
102
|
+
elIFrame.src = sSkinURI;
|
103
|
+
};
|
104
|
+
|
105
|
+
this.showBlocker = function(){
|
106
|
+
if(this.nBlockerCount<1){
|
107
|
+
var elBlocker = document.createElement("DIV");
|
108
|
+
elBlocker.style.position = "absolute";
|
109
|
+
elBlocker.style.top = 0;
|
110
|
+
elBlocker.style.left = 0;
|
111
|
+
elBlocker.style.backgroundColor = "#FFFFFF";
|
112
|
+
elBlocker.style.width = "100%";
|
113
|
+
|
114
|
+
document.body.appendChild(elBlocker);
|
115
|
+
|
116
|
+
nhn.husky.EZCreator.elBlocker = elBlocker;
|
117
|
+
}
|
118
|
+
|
119
|
+
nhn.husky.EZCreator.elBlocker.style.height = Math.max(document.body.scrollHeight, document.body.clientHeight)+"px";
|
120
|
+
|
121
|
+
this.nBlockerCount++;
|
122
|
+
};
|
123
|
+
|
124
|
+
this.hideBlocker = function(bForce){
|
125
|
+
if(!bForce){
|
126
|
+
if(--this.nBlockerCount > 0) return;
|
127
|
+
}
|
128
|
+
|
129
|
+
this.nBlockerCount = 0;
|
130
|
+
|
131
|
+
if(nhn.husky.EZCreator.elBlocker) nhn.husky.EZCreator.elBlocker.style.display = "none";
|
132
|
+
}
|
133
|
+
})();
|
@@ -0,0 +1,77 @@
|
|
1
|
+
/*
|
2
|
+
* Smart Editor 2 Configuration
|
3
|
+
*/
|
4
|
+
if(typeof window.nhn=='undefined'){window.nhn = {};}
|
5
|
+
if (!nhn.husky){nhn.husky = {};}
|
6
|
+
nhn.husky.SE2M_Configuration = {};
|
7
|
+
|
8
|
+
nhn.husky.SE2M_Configuration.Editor = {
|
9
|
+
sJsBaseURL : './js_src',
|
10
|
+
sImageBaseURL : './img'
|
11
|
+
};
|
12
|
+
|
13
|
+
nhn.husky.SE2M_Configuration.LinkageDomain = {
|
14
|
+
sCommonAPI : 'http://api.se2.naver.com',
|
15
|
+
sCommonStatic : 'http://static.se2.naver.com',
|
16
|
+
sCommonImage : 'http://images.se2.naver.com'
|
17
|
+
};
|
18
|
+
|
19
|
+
nhn.husky.SE2M_Configuration.SE_EditingAreaManager = {
|
20
|
+
sBlankPageURL : "smart_editor2_inputarea.html",
|
21
|
+
sBlankPageURL_EmulateIE7 : "smart_editor2_inputarea_ie8.html",
|
22
|
+
aAddtionalEmulateIE7 : [9, 10] // IE8 default 사용, IE9 ~ 선택적 사용
|
23
|
+
};
|
24
|
+
|
25
|
+
nhn.husky.SE2M_Configuration.LazyLoad = {
|
26
|
+
sJsBaseURI : "js_lazyload"
|
27
|
+
};
|
28
|
+
|
29
|
+
nhn.husky.SE2M_Configuration.SE2B_CSSLoader = {
|
30
|
+
sCSSBaseURI : "/assets/smart_editor"
|
31
|
+
};
|
32
|
+
|
33
|
+
nhn.husky.SE2M_Configuration.Quote = {
|
34
|
+
sImageBaseURL : 'http://static.se2.naver.com/static/img'
|
35
|
+
};
|
36
|
+
|
37
|
+
nhn.husky.SE2M_Configuration.CustomObject = {
|
38
|
+
sVersion : 1,
|
39
|
+
sClassName : '__se_object',
|
40
|
+
sValueName : 'jsonvalue',
|
41
|
+
sTagIdPrefix : 'se_object_',
|
42
|
+
sTailComment : '<!--__se_object_end -->',
|
43
|
+
sBlankTemplateURL : nhn.husky.SE2M_Configuration.LinkageDomain.sCommonStatic + '/static/db_attach/iframe_template_for_se1_obj.html',
|
44
|
+
sAttributeOfEmpty : 's_isempty="true"',
|
45
|
+
sAttributeOfOldDB : 's_olddb="true"',
|
46
|
+
sBlock : '<div class="_block" style="position:absolute;z-index:10000;background-color:#fff;"></div>',
|
47
|
+
sBlokTemplate : '<div[\\s\\S]*?class=[\'"]?_block[\'"]?[\\s\\S]*?</div>',
|
48
|
+
sHighlight : '<div class="_highlight" style="position:absolute;width:58px;height:16px;line-height:0;z-index:9999"><img src="' + nhn.husky.SE2M_Configuration.LinkageDomain.sCommonStatic + '/static/img/pencil2.png" alt="" width="58" height="16" style="vertical-align:top"></div>',
|
49
|
+
sHighlightTemplate : '<div[\\s\\S]*?class=[\'"]?_highlight[\'"]?[\\s\\S]*?</div>',
|
50
|
+
sHtmlTemplateStartTag : '<!-- se_object_template_start -->',
|
51
|
+
sHtmlTemplateEndTag : '<!-- se_object_template_end -->',
|
52
|
+
sHtmlFilterTag : '{=sType}_{=sSubType}_{=nSeq}',
|
53
|
+
sTplHtmlFilterTag : '<!--{=sType}_{=sSubType}_(\\d+)-->',
|
54
|
+
sImgComServerPath : nhn.husky.SE2M_Configuration.LinkageDomain.sCommonStatic + '/static/img/reviewitem',
|
55
|
+
nMaxWidth : 548
|
56
|
+
};
|
57
|
+
|
58
|
+
nhn.husky.SE2M_Configuration.SE2M_ReEditAction = {
|
59
|
+
bUsed : true,
|
60
|
+
nSecDisplayDulationReEditMsg : 3,
|
61
|
+
aReEditGuideMsg : [
|
62
|
+
'이미지 파일은 1회 클릭 시 크기 조절, 더블클릭 시 재편집이 가능합니다.',
|
63
|
+
'첨부한 파일을 더블클릭 시 재편집이 가능합니다.',
|
64
|
+
'첨부한 글양식 테이블을 드래그시 테이블 재편집이 가능합니다.',
|
65
|
+
'첨부한 표를 드래그 시 표 재편집이 가능합니다.'
|
66
|
+
]
|
67
|
+
};
|
68
|
+
|
69
|
+
nhn.husky.SE2M_Configuration.SE2M_ColorPalette = {
|
70
|
+
bUseRecentColor : false
|
71
|
+
};
|
72
|
+
|
73
|
+
nhn.husky.SE2M_Configuration.QuickEditor = {
|
74
|
+
common : {
|
75
|
+
bUseConfig : false
|
76
|
+
}
|
77
|
+
};
|
@@ -0,0 +1,85 @@
|
|
1
|
+
function createSEditor2(elIRField, htParams, elSeAppContainer){
|
2
|
+
if(!window.$Jindo){
|
3
|
+
parent.document.body.innerHTML="진도 프레임웍이 필요합니다.<br>\n<a href='http://dev.naver.com/projects/jindo/download'>http://dev.naver.com/projects/jindo/download</a>에서 Jindo 1.5.3 버전의 jindo.min.js를 다운로드 받아 /js 폴더에 복사 해 주세요.\n(아직 Jindo 2 는 지원하지 않습니다.)";
|
4
|
+
return;
|
5
|
+
}
|
6
|
+
|
7
|
+
var elAppContainer = (elSeAppContainer || jindo.$("smart_editor2"));
|
8
|
+
var elEditingArea = jindo.$$.getSingle("DIV.husky_seditor_editing_area_container", elAppContainer);
|
9
|
+
var oWYSIWYGIFrame = jindo.$$.getSingle("IFRAME.se2_input_wysiwyg", elEditingArea);
|
10
|
+
var oIRTextarea = elIRField?elIRField:jindo.$$.getSingle("TEXTAREA.blind", elEditingArea);
|
11
|
+
var oHTMLSrc = jindo.$$.getSingle("TEXTAREA.se2_input_htmlsrc", elEditingArea);
|
12
|
+
var oTextArea = jindo.$$.getSingle("TEXTAREA.se2_input_text", elEditingArea);
|
13
|
+
|
14
|
+
if(!htParams){
|
15
|
+
htParams = {};
|
16
|
+
htParams.fOnBeforeUnload = null;
|
17
|
+
}
|
18
|
+
htParams.elAppContainer = elAppContainer; // 에디터 UI 최상위 element 셋팅
|
19
|
+
htParams.oNavigator = jindo.$Agent().navigator(); // navigator 객체 셋팅
|
20
|
+
|
21
|
+
var oEditor = new nhn.husky.HuskyCore(htParams);
|
22
|
+
oEditor.registerPlugin(new nhn.husky.CorePlugin(htParams?htParams.fOnAppLoad:null));
|
23
|
+
oEditor.registerPlugin(new nhn.husky.StringConverterManager());
|
24
|
+
|
25
|
+
var htDimension = {
|
26
|
+
nMinHeight:205,
|
27
|
+
nMinWidth:parseInt(elIRField.style.minWidth, 10)||570,
|
28
|
+
nHeight:elIRField.style.height||elIRField.offsetHeight,
|
29
|
+
nWidth:elIRField.style.width||elIRField.offsetWidth
|
30
|
+
};
|
31
|
+
oEditor.registerPlugin(new nhn.husky.SE_EditingAreaManager("WYSIWYG", oIRTextarea, htDimension, htParams.fOnBeforeUnload, elAppContainer));
|
32
|
+
oEditor.registerPlugin(new nhn.husky.SE_EditingArea_WYSIWYG(oWYSIWYGIFrame)); // Tab Editor 모드
|
33
|
+
oEditor.registerPlugin(new nhn.husky.SE_EditingArea_HTMLSrc(oHTMLSrc)); // Tab HTML 모드
|
34
|
+
oEditor.registerPlugin(new nhn.husky.SE_EditingArea_TEXT(oTextArea)); // Tab Text 모드
|
35
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_EditingModeChanger(elAppContainer)); // 모드간 변경(Editor, HTML, Text)
|
36
|
+
|
37
|
+
oEditor.registerPlugin(new nhn.husky.HuskyRangeManager(oWYSIWYGIFrame));
|
38
|
+
oEditor.registerPlugin(new nhn.husky.Utils());
|
39
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_UtilPlugin());
|
40
|
+
oEditor.registerPlugin(new nhn.husky.SE_WYSIWYGStyler());
|
41
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_Toolbar(elAppContainer));
|
42
|
+
|
43
|
+
oEditor.registerPlugin(new nhn.husky.Hotkey()); // 단축키
|
44
|
+
oEditor.registerPlugin(new nhn.husky.SE_EditingAreaVerticalResizer(elAppContainer)); // 편집영역 리사이즈
|
45
|
+
oEditor.registerPlugin(new nhn.husky.DialogLayerManager());
|
46
|
+
oEditor.registerPlugin(new nhn.husky.ActiveLayerManager());
|
47
|
+
oEditor.registerPlugin(new nhn.husky.SE_WYSIWYGStyleGetter()); // 커서 위치 스타일 정보 가져오기
|
48
|
+
|
49
|
+
oEditor.registerPlugin(new nhn.husky.SE2B_Customize_ToolBar(elAppContainer)); // 상단 툴바 (Basic)
|
50
|
+
oEditor.registerPlugin(new nhn.husky.SE_WYSIWYGEnterKey("P")); // 엔터 시 처리, 현재는 P로 처리
|
51
|
+
|
52
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_ColorPalette(elAppContainer)); // 색상 팔레트
|
53
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_FontColor(elAppContainer)); // 글자색
|
54
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_BGColor(elAppContainer)); // 글자배경색
|
55
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_FontNameWithLayerUI(elAppContainer)); // 글꼴종류
|
56
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_FontSizeWithLayerUI(elAppContainer)); // 글꼴크기
|
57
|
+
|
58
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_LineStyler());
|
59
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_ExecCommand(oWYSIWYGIFrame));
|
60
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_LineHeightWithLayerUI(elAppContainer)); // 줄간격
|
61
|
+
|
62
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_Quote(elAppContainer)); // 인용구
|
63
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_Hyperlink(elAppContainer)); // 링크
|
64
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_SCharacter(elAppContainer)); // 특수문자
|
65
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_FindReplacePlugin(elAppContainer)); // 찾기/바꾸기
|
66
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_TableCreator(elAppContainer)); // 테이블 생성
|
67
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_TableEditor(elAppContainer)); // 테이블 편집
|
68
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_TableBlockStyler(elAppContainer)); // 테이블 스타일
|
69
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_AttachQuickPhoto(elAppContainer)); // 사진
|
70
|
+
|
71
|
+
oEditor.registerPlugin(new nhn.husky.MessageManager(oMessageMap));
|
72
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_QuickEditor_Common(elAppContainer)); // 퀵에디터 공통(표, 이미지)
|
73
|
+
|
74
|
+
|
75
|
+
if(jindo.$Agent().navigator().ie){
|
76
|
+
oEditor.registerPlugin(new nhn.husky.SE2M_ImgSizeRatioKeeper()); // 이미지 선택한 이후 마우스로 크기 조정하면 정비율로 변경
|
77
|
+
}
|
78
|
+
|
79
|
+
oEditor.registerPlugin(new nhn.husky.SE2B_CSSLoader()); // CSS lazy load
|
80
|
+
oEditor.registerPlugin(new nhn.husky.SE_OuterIFrameControl(elAppContainer, 100));
|
81
|
+
|
82
|
+
oEditor.registerPlugin(new nhn.husky.SE_ToolbarToggler(elAppContainer, htParams.bUseToolbar));
|
83
|
+
|
84
|
+
return oEditor;
|
85
|
+
}
|
@@ -0,0 +1,106 @@
|
|
1
|
+
/**
|
2
|
+
* @use 간단 포토 업로드용으로 제작되었습니다.
|
3
|
+
* @author cielo
|
4
|
+
* @See nhn.husky.SE2M_Configuration
|
5
|
+
* @ 팝업 마크업은 SimplePhotoUpload.html과 SimplePhotoUpload_html5.html이 있습니다.
|
6
|
+
*/
|
7
|
+
|
8
|
+
nhn.husky.SE2M_AttachQuickPhoto = jindo.$Class({
|
9
|
+
name : "SE2M_AttachQuickPhoto",
|
10
|
+
|
11
|
+
$init : function(){},
|
12
|
+
|
13
|
+
$ON_MSG_APP_READY : function(){
|
14
|
+
alert('ready');
|
15
|
+
this.oApp.exec("REGISTER_UI_EVENT", ["photo_attach", "click", "ATTACHPHOTO_OPEN_WINDOW"]);
|
16
|
+
},
|
17
|
+
|
18
|
+
$LOCAL_BEFORE_FIRST : function(sMsg){
|
19
|
+
if(!!this.oPopupMgr){ return; }
|
20
|
+
// Popup Manager에서 사용할 param
|
21
|
+
this.htPopupOption = {
|
22
|
+
oApp : this.oApp,
|
23
|
+
sName : this.name,
|
24
|
+
bScroll : false,
|
25
|
+
sProperties : "",
|
26
|
+
sUrl : ""
|
27
|
+
};
|
28
|
+
this.oPopupMgr = nhn.husky.PopUpManager.getInstance(this.oApp);
|
29
|
+
},
|
30
|
+
|
31
|
+
/**
|
32
|
+
* 포토 웹탑 오픈
|
33
|
+
*/
|
34
|
+
$ON_ATTACHPHOTO_OPEN_WINDOW : function(){
|
35
|
+
this.htPopupOption.sUrl = this.makePopupURL();
|
36
|
+
this.htPopupOption.sProperties = "left=0,top=0,width=383,height=339,scrollbars=no,location=no,status=0,resizable=no";
|
37
|
+
|
38
|
+
this.oPopupWindow = this.oPopupMgr.openWindow(this.htPopupOption);
|
39
|
+
|
40
|
+
// 처음 로딩하고 IE에서 커서가 전혀 없는 경우
|
41
|
+
// 복수 업로드시에 순서가 바뀜
|
42
|
+
this.oApp.exec('FOCUS');
|
43
|
+
return (!!this.oPopupWindow ? true : false);
|
44
|
+
},
|
45
|
+
|
46
|
+
/**
|
47
|
+
* 서비스별로 팝업에 parameter를 추가하여 URL을 생성하는 함수
|
48
|
+
* nhn.husky.SE2M_AttachQuickPhoto.prototype.makePopupURL로 덮어써서 사용하시면 됨.
|
49
|
+
*/
|
50
|
+
makePopupURL : function(){
|
51
|
+
var sPopupUrl = "./popup/quick_photo/Photo_Quick_UploadPopup.html";
|
52
|
+
return sPopupUrl;
|
53
|
+
},
|
54
|
+
|
55
|
+
/**
|
56
|
+
* 팝업에서 호출되는 메세지.
|
57
|
+
*/
|
58
|
+
$ON_SET_PHOTO : function(aPhotoData){
|
59
|
+
alert('parapara');
|
60
|
+
var sContents,
|
61
|
+
aPhotoInfo,
|
62
|
+
htData;
|
63
|
+
|
64
|
+
if( !aPhotoData ){
|
65
|
+
return;
|
66
|
+
}
|
67
|
+
|
68
|
+
try{
|
69
|
+
sContents = "";
|
70
|
+
for(var i = 0; i <aPhotoData.length; i++){
|
71
|
+
htData = aPhotoData[i];
|
72
|
+
|
73
|
+
if(!htData.sAlign){
|
74
|
+
htData.sAlign = "";
|
75
|
+
}
|
76
|
+
|
77
|
+
aPhotoInfo = {
|
78
|
+
sName : htData.sFileName || "",
|
79
|
+
sOriginalImageURL : htData.sFileURL,
|
80
|
+
bNewLine : htData.bNewLine || false
|
81
|
+
};
|
82
|
+
|
83
|
+
sContents += this._getPhotoTag(aPhotoInfo);
|
84
|
+
}
|
85
|
+
|
86
|
+
this.oApp.exec("PASTE_HTML", [sContents]); // 위즐 첨부 파일 부분 확인
|
87
|
+
}catch(e){
|
88
|
+
// upload시 error발생에 대해서 skip함
|
89
|
+
return false;
|
90
|
+
}
|
91
|
+
},
|
92
|
+
|
93
|
+
/**
|
94
|
+
* @use 일반 포토 tag 생성
|
95
|
+
*/
|
96
|
+
_getPhotoTag : function(htPhotoInfo){
|
97
|
+
// id와 class는 썸네일과 연관이 많습니다. 수정시 썸네일 영역도 Test
|
98
|
+
var sTag = '<img src="{=sOriginalImageURL}" title="{=sName}" >';
|
99
|
+
if(htPhotoInfo.bNewLine){
|
100
|
+
sTag += '<br style="clear:both;">';
|
101
|
+
}
|
102
|
+
sTag = jindo.$Template(sTag).process(htPhotoInfo);
|
103
|
+
|
104
|
+
return sTag;
|
105
|
+
}
|
106
|
+
});
|