mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-27 23:29:57 +09:00
삭제
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2327 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
commit
8326004cb2
2773 changed files with 91485 additions and 0 deletions
135
modules/editor/components/image_link/tpl/popup.js
Normal file
135
modules/editor/components/image_link/tpl/popup.js
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
/**
|
||||
* popup으로 열렸을 경우 부모창의 위지윅에디터에 select된 이미지가 있는지 체크하여
|
||||
* 있으면 가져와서 원하는 곳에 삽입
|
||||
**/
|
||||
|
||||
var orig_width = 0;
|
||||
var orig_height = 0;
|
||||
function getImage() {
|
||||
// 부모 위지윅 에디터에서 선택된 영역이 있는지 확인
|
||||
if(typeof(opener)=="undefined") return;
|
||||
|
||||
// url이 미리 입력되어 있을 경우 scale구해줌
|
||||
if(xGetElementById("image_url").value) {
|
||||
getImageScale();
|
||||
return;
|
||||
}
|
||||
|
||||
// 부모 위지윅 에디터에서 선택된 영역이 있으면 처리
|
||||
var node = opener.editorPrevNode;
|
||||
if(!node || node.nodeName != "IMG") {
|
||||
return;
|
||||
}
|
||||
var src = node.getAttribute("src");
|
||||
var border = node.getAttribute("border");
|
||||
var align = node.getAttribute("align");
|
||||
var alt = node.getAttribute("alt");
|
||||
var width = node.getAttribute("width");
|
||||
var height = node.getAttribute("height");
|
||||
orig_width = width;
|
||||
orig_height = height;
|
||||
var link_url = node.getAttribute("link_url");
|
||||
var open_window = node.getAttribute("open_window");
|
||||
|
||||
xGetElementById("image_url").value = src;
|
||||
xGetElementById("image_alt").value = alt;
|
||||
|
||||
if(link_url) {
|
||||
link_url = link_url.replace(/<([^>]*)>/ig,'').replace(/</ig,'<').replace(/>/ig,'>').replace(/&/ig,'&');
|
||||
xGetElementById('link_url').value = link_url;
|
||||
}
|
||||
if(open_window == 'Y') xGetElementById('open_window').checked = "true";
|
||||
|
||||
switch(align) {
|
||||
case 'left' : xGetElementById("align_left").checked = true; break;
|
||||
case 'middle' : xGetElementById("align_middle").checked = true; break;
|
||||
case 'right' : xGetElementById("align_right").checked = true; break;
|
||||
default : xGetElementById("align_normal").checked = true; break;
|
||||
}
|
||||
|
||||
xGetElementById("image_border").value = border;
|
||||
|
||||
xGetElementById("width").value = width;
|
||||
xGetElementById("height").value = height;
|
||||
|
||||
}
|
||||
|
||||
function getImageScale() {
|
||||
var url = xGetElementById("image_url").value;
|
||||
if(!url) return;
|
||||
|
||||
var img = new Image();
|
||||
img.src = url;
|
||||
|
||||
xGetElementById("width").value = img.width;
|
||||
xGetElementById("height").value = img.height;
|
||||
|
||||
orig_width = img.width;
|
||||
orig_height = img.height;
|
||||
}
|
||||
function insertImage(obj) {
|
||||
if(typeof(opener)=="undefined") return;
|
||||
|
||||
var link_url = xGetElementById('link_url').value;
|
||||
if(link_url) link_url = link_url.replace(/&/ig,'&').replace(/</ig,'<').replace(/>/ig,'>');
|
||||
var open_window = 'N';
|
||||
if(xGetElementById('open_window').checked) open_window = 'Y';
|
||||
|
||||
var url = xGetElementById("image_url").value;
|
||||
var alt = xGetElementById("image_alt").value;
|
||||
var align = "";
|
||||
if(xGetElementById("align_normal").checked==true) align = "";
|
||||
else if(xGetElementById("align_left").checked==true) align = "left";
|
||||
else if(xGetElementById("align_middle").checked==true) align = "middle";
|
||||
else if(xGetElementById("align_right").checked==true) align = "right";
|
||||
var border = parseInt(xGetElementById("image_border").value,10);
|
||||
|
||||
var width = xGetElementById("width").value;
|
||||
var height = xGetElementById("height").value;
|
||||
|
||||
if(!url) {
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
||||
url = url.replace(request_uri,'');
|
||||
var text = "<img editor_component=\"image_link\" src=\""+url+"\" border=\""+border+"\" ";
|
||||
if(alt) text+= " alt=\""+alt+"\"";
|
||||
if(width) text+= " width=\""+width+"\" ";
|
||||
if(height) text+= " height=\""+height+"\" ";
|
||||
if(link_url) text+= " link_url=\""+link_url+"\" ";
|
||||
if(open_window=='Y') text+= " open_window=\"Y\" ";
|
||||
if(align) text+= " align=\""+align+"\" ";
|
||||
text+= " />";
|
||||
|
||||
opener.editorFocus(opener.editorPrevSrl);
|
||||
|
||||
var iframe_obj = opener.editorGetIFrame(opener.editorPrevSrl)
|
||||
|
||||
opener.editorReplaceHTML(iframe_obj, text);
|
||||
opener.editorFocus(opener.editorPrevSrl);
|
||||
|
||||
window.close();
|
||||
}
|
||||
|
||||
xAddEventListener(window, "load", getImage);
|
||||
|
||||
function setScale(type) {
|
||||
switch(type) {
|
||||
case 'width' :
|
||||
if(!orig_height) return;
|
||||
var n_width = xGetElementById('width').value;
|
||||
var p = n_width/orig_width;
|
||||
var n_height = parseInt(orig_height * p,10);
|
||||
xGetElementById('height').value = n_height;
|
||||
break;
|
||||
case 'height' :
|
||||
if(!orig_width) return;
|
||||
var n_height = xGetElementById('height').value;
|
||||
var p = n_height/orig_height;
|
||||
var n_width = parseInt(orig_width * p,10);
|
||||
xGetElementById('width').value = n_width;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue