mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-24 05:39:58 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@540 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
5c8454f6ed
commit
318b5f1f56
5 changed files with 90 additions and 25 deletions
|
|
@ -1,6 +1,8 @@
|
|||
.editor_window {
|
||||
width:400px;
|
||||
height:200px;
|
||||
text-align:center;
|
||||
clear:both;
|
||||
}
|
||||
|
||||
.header {
|
||||
|
|
@ -37,12 +39,11 @@
|
|||
}
|
||||
|
||||
.editor_button_area {
|
||||
clear:both;
|
||||
width:100%;
|
||||
text-align:center;
|
||||
background-color:#EEEEEE;
|
||||
padding-top:5px;
|
||||
height:30px;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.editor_button {
|
||||
|
|
|
|||
|
|
@ -19,25 +19,27 @@
|
|||
<div class="body">
|
||||
<span>
|
||||
<input type="radio" name="color" value="blue" id="color_blue" />
|
||||
<label for="color_blue"><a href="#" class="editor_blue_text">{$lang->urllink_color_blue}</a></label>
|
||||
<label for="color_blue" class="editor_blue_text">{$lang->urllink_color_blue}</label>
|
||||
</span>
|
||||
<span>
|
||||
<input type="radio" name="color" value="red" id="color_red" />
|
||||
<label for="color_red"><a href="#" class="editor_red_text">{$lang->urllink_color_red}</a></label>
|
||||
<label for="color_red" class="editor_red_text">{$lang->urllink_color_red}</label>
|
||||
</span>
|
||||
<span>
|
||||
<input type="radio" name="color" value="yellow" id="color_yellow" />
|
||||
<label for="color_yellow"><a href="#" class="editor_yellow_text">{$lang->urllink_color_yellow}</a></label>
|
||||
<label for="color_yellow" class="editor_yellow_text">{$lang->urllink_color_yellow}</label>
|
||||
</span>
|
||||
<span>
|
||||
<input type="radio" name="color" value="green" id="color_green" />
|
||||
<label for="color_green"><a href="#" class="editor_green_text">{$lang->urllink_color_green}</a></label>
|
||||
<label for="color_green" class="editor_green_text">{$lang->urllink_color_green}</label>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="editor_button_area">
|
||||
<input type="button" class="editor_button" value="{$lang->cmd_insert}" onclick="setText()" />
|
||||
<input type="button" class="editor_button" value="{$lang->cmd_close}" onclick="window.close()" />
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,66 @@
|
|||
* 있으면 가져와서 원하는 곳에 삽입
|
||||
**/
|
||||
function getText() {
|
||||
// 부모 위지윅 에디터에서 선택된 영역이 있는지 확인
|
||||
if(typeof(opener)=="undefined") return;
|
||||
var text = opener.editorGetSelectedHtml(opener.editorPrevSrl);
|
||||
|
||||
// 선택된 영역이 A태그인지 확인
|
||||
if(text) {
|
||||
var node = opener.editorGetSelectedNode(opener.editorPrevSrl);
|
||||
if(node.nodeName == "A") {
|
||||
var url = node.getAttribute("HREF");
|
||||
|
||||
var onclick_str = "";
|
||||
if(xIE4Up) {
|
||||
onclick_str = node.outerHTML;
|
||||
} else {
|
||||
if(node.getAttribute("onclick")) onclick_str = node.getAttribute("onclick");
|
||||
}
|
||||
|
||||
var className = "";
|
||||
if(typeof(node.className)) className = node.className;
|
||||
else className = node.getAttribute("class");
|
||||
var open_window = false;
|
||||
|
||||
if(onclick_str) {
|
||||
open_window = true;
|
||||
|
||||
var s_s = "window.open('";
|
||||
var p_s = onclick_str.indexOf(s_s);
|
||||
url = onclick_str.substr(p_s+s_s.length);
|
||||
|
||||
var e_s = "')";
|
||||
var p_e = url.indexOf(e_s);
|
||||
url = url.substr(0, p_e);
|
||||
|
||||
}
|
||||
|
||||
var bold = false;
|
||||
var color = "";
|
||||
|
||||
if(className) {
|
||||
if(className.indexOf("bold")>-1) bold = true;
|
||||
|
||||
if(className.indexOf("blue")>0) color = "color_blue";
|
||||
else if(className.indexOf("red")>0) color = "color_red";
|
||||
else if(className.indexOf("yellow")>0) color = "color_yellow";
|
||||
else if(className.indexOf("green")>0) color = "color_green";
|
||||
}
|
||||
|
||||
var fo_obj = xGetElementById("fo_component");
|
||||
|
||||
fo_obj.text.value = xInnerHtml(node);
|
||||
fo_obj.url.value = url;
|
||||
if(open_window) fo_obj.open_window.checked = true;
|
||||
if(bold) fo_obj.bold.checked = true;
|
||||
if(color) xGetElementById(color).checked = true;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 기본 설정
|
||||
var fo_obj = xGetElementById("fo_component");
|
||||
if(fo_obj.text.value) return;
|
||||
fo_obj.text.value = text;
|
||||
|
|
@ -30,6 +88,8 @@ function setText() {
|
|||
return;
|
||||
}
|
||||
|
||||
if(!url) url = "#";
|
||||
|
||||
if(fo_obj.open_window.checked) open_window = true;
|
||||
if(fo_obj.bold.checked) bold= true;
|
||||
if(xGetElementById("color_blue").checked) link_class = "editor_blue_text";
|
||||
|
|
|
|||
|
|
@ -138,6 +138,23 @@ function editorGetSelectedHtml(upload_target_srl) {
|
|||
}
|
||||
}
|
||||
|
||||
// 에디터 내의 선택된 부분의 NODE를 return
|
||||
function editorGetSelectedNode(upload_target_srl) {
|
||||
var iframe_obj = editorGetIFrame(upload_target_srl);
|
||||
if(xIE4Up) {
|
||||
var range = iframe_obj.contentWindow.document.selection.createRange();
|
||||
var div = xCreateElement('div');
|
||||
xInnerHtml(div, range.htmlText);
|
||||
var node = div.firstChild;
|
||||
return node;
|
||||
} else {
|
||||
var range = iframe_obj.contentWindow.getSelection().getRangeAt(0);
|
||||
var node = xCreateElement('div');
|
||||
node.appendChild(range.cloneContents());
|
||||
return node.firstChild;
|
||||
}
|
||||
}
|
||||
|
||||
// 에디터 내의 선택된 부분의 html코드를 변경
|
||||
function editorReplaceHTML(iframe_obj, html) {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue