This commit is contained in:
alvis
2020-06-14 16:44:45 +08:00
parent 6a10ed3e16
commit 943dae05da
2150 changed files with 986029 additions and 17 deletions

View File

@@ -0,0 +1,894 @@
@charset "utf-8";
/* dialog样式 */
.wrapper {
zoom: 1;
width: 630px;
*width: 626px;
height: 380px;
margin: 0 auto;
padding: 10px;
position: relative;
font-family: sans-serif;
}
/*tab样式框大小*/
.tabhead {
float:left;
}
.tabbody {
width: 100%;
height: 346px;
position: relative;
clear: both;
}
.tabbody .panel {
position: absolute;
width: 0;
height: 0;
background: #fff;
overflow: hidden;
display: none;
}
.tabbody .panel.focus {
width: 100%;
height: 346px;
display: block;
}
/* 图片对齐方式 */
.alignBar{
float:right;
margin-top: 5px;
position: relative;
}
.alignBar .algnLabel{
float:left;
height: 20px;
line-height: 20px;
}
.alignBar #alignIcon{
zoom:1;
_display: inline;
display: inline-block;
position: relative;
}
.alignBar #alignIcon span{
float: left;
cursor: pointer;
display: block;
width: 19px;
height: 17px;
margin-right: 3px;
margin-left: 3px;
background-image: url(./images/alignicon.jpg);
}
.alignBar #alignIcon .none-align{
background-position: 0 -18px;
}
.alignBar #alignIcon .left-align{
background-position: -20px -18px;
}
.alignBar #alignIcon .right-align{
background-position: -40px -18px;
}
.alignBar #alignIcon .center-align{
background-position: -60px -18px;
}
.alignBar #alignIcon .none-align.focus{
background-position: 0 0;
}
.alignBar #alignIcon .left-align.focus{
background-position: -20px 0;
}
.alignBar #alignIcon .right-align.focus{
background-position: -40px 0;
}
.alignBar #alignIcon .center-align.focus{
background-position: -60px 0;
}
/* 远程图片样式 */
#remote {
z-index: 200;
}
#remote .top{
width: 100%;
margin-top: 25px;
}
#remote .left{
display: block;
float: left;
width: 300px;
height:10px;
}
#remote .right{
display: block;
float: right;
width: 300px;
height:10px;
}
#remote .row{
margin-left: 20px;
clear: both;
height: 40px;
}
#remote .row label{
text-align: center;
width: 50px;
zoom:1;
_display: inline;
display:inline-block;
vertical-align: middle;
}
#remote .row label.algnLabel{
float: left;
}
#remote input.text{
width: 150px;
padding: 3px 6px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
#remote input.text:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
}
#remote #url{
width: 500px;
margin-bottom: 2px;
}
#remote #width,
#remote #height{
width: 20px;
margin-left: 2px;
margin-right: 2px;
}
#remote #border,
#remote #vhSpace,
#remote #title{
width: 180px;
margin-right: 5px;
}
#remote #lock{
}
#remote #lockicon{
zoom: 1;
_display:inline;
display: inline-block;
width: 20px;
height: 20px;
background: url("../../themes/default/images/lock.gif") -13px -13px no-repeat;
vertical-align: middle;
}
#remote #preview{
clear: both;
width: 260px;
height: 240px;
z-index: 9999;
margin-top: 10px;
background-color: #eee;
overflow: hidden;
}
/* 上传图片 */
.tabbody #upload.panel {
width: 0;
height: 0;
overflow: hidden;
position: absolute !important;
clip: rect(1px, 1px, 1px, 1px);
background: #fff;
display: block;
}
.tabbody #upload.panel.focus {
width: 100%;
height: 346px;
display: block;
clip: auto;
}
#upload .queueList {
margin: 0;
width: 100%;
height: 100%;
position: absolute;
overflow: hidden;
}
#upload p {
margin: 0;
}
.element-invisible {
width: 0 !important;
height: 0 !important;
border: 0;
padding: 0;
margin: 0;
overflow: hidden;
position: absolute !important;
clip: rect(1px, 1px, 1px, 1px);
}
#upload .placeholder {
margin: 10px;
border: 2px dashed #e6e6e6;
*border: 0px dashed #e6e6e6;
height: 172px;
padding-top: 150px;
text-align: center;
background: url(./images/image.png) center 70px no-repeat;
color: #cccccc;
font-size: 18px;
position: relative;
top:0;
*top: 10px;
}
#upload .placeholder .webuploader-pick {
font-size: 18px;
background: #00b7ee;
border-radius: 3px;
line-height: 44px;
padding: 0 30px;
*width: 120px;
color: #fff;
display: inline-block;
margin: 0 auto 20px auto;
cursor: pointer;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}
#upload .placeholder .webuploader-pick-hover {
background: #00a2d4;
}
#filePickerContainer {
text-align: center;
}
#upload .placeholder .flashTip {
color: #666666;
font-size: 12px;
position: absolute;
width: 100%;
text-align: center;
bottom: 20px;
}
#upload .placeholder .flashTip a {
color: #0785d1;
text-decoration: none;
}
#upload .placeholder .flashTip a:hover {
text-decoration: underline;
}
#upload .placeholder.webuploader-dnd-over {
border-color: #999999;
}
#upload .filelist {
list-style: none;
margin: 0;
padding: 0;
overflow-x: hidden;
overflow-y: auto;
position: relative;
height: 300px;
}
#upload .filelist:after {
content: '';
display: block;
width: 0;
height: 0;
overflow: hidden;
clear: both;
position: relative;
}
#upload .filelist li {
width: 113px;
height: 113px;
background: url(./images/bg.png);
text-align: center;
margin: 9px 0 0 9px;
*margin: 6px 0 0 6px;
position: relative;
display: block;
float: left;
overflow: hidden;
font-size: 12px;
}
#upload .filelist li p.log {
position: relative;
top: -45px;
}
#upload .filelist li p.title {
position: absolute;
top: 0;
left: 0;
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
top: 5px;
text-indent: 5px;
text-align: left;
}
#upload .filelist li p.progress {
position: absolute;
width: 100%;
bottom: 0;
left: 0;
height: 8px;
overflow: hidden;
z-index: 50;
margin: 0;
border-radius: 0;
background: none;
-webkit-box-shadow: 0 0 0;
}
#upload .filelist li p.progress span {
display: none;
overflow: hidden;
width: 0;
height: 100%;
background: #1483d8 url(./images/progress.png) repeat-x;
-webit-transition: width 200ms linear;
-moz-transition: width 200ms linear;
-o-transition: width 200ms linear;
-ms-transition: width 200ms linear;
transition: width 200ms linear;
-webkit-animation: progressmove 2s linear infinite;
-moz-animation: progressmove 2s linear infinite;
-o-animation: progressmove 2s linear infinite;
-ms-animation: progressmove 2s linear infinite;
animation: progressmove 2s linear infinite;
-webkit-transform: translateZ(0);
}
@-webkit-keyframes progressmove {
0% {
background-position: 0 0;
}
100% {
background-position: 17px 0;
}
}
@-moz-keyframes progressmove {
0% {
background-position: 0 0;
}
100% {
background-position: 17px 0;
}
}
@keyframes progressmove {
0% {
background-position: 0 0;
}
100% {
background-position: 17px 0;
}
}
#upload .filelist li p.imgWrap {
position: relative;
z-index: 2;
line-height: 113px;
vertical-align: middle;
overflow: hidden;
width: 113px;
height: 113px;
-webkit-transform-origin: 50% 50%;
-moz-transform-origin: 50% 50%;
-o-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webit-transition: 200ms ease-out;
-moz-transition: 200ms ease-out;
-o-transition: 200ms ease-out;
-ms-transition: 200ms ease-out;
transition: 200ms ease-out;
}
#upload .filelist li img {
width: 100%;
}
#upload .filelist li p.error {
background: #f43838;
color: #fff;
position: absolute;
bottom: 0;
left: 0;
height: 28px;
line-height: 28px;
width: 100%;
z-index: 100;
display:none;
}
#upload .filelist li .success {
display: block;
position: absolute;
left: 0;
bottom: 0;
height: 40px;
width: 100%;
z-index: 200;
background: url(./images/success.png) no-repeat right bottom;
background: url(./images/success.gif) no-repeat right bottom \9;
}
#upload .filelist li.filePickerBlock {
width: 113px;
height: 113px;
background: url(./images/image.png) no-repeat center 12px;
border: 1px solid #eeeeee;
border-radius: 0;
}
#upload .filelist li.filePickerBlock div.webuploader-pick {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
opacity: 0;
background: none;
font-size: 0;
}
#upload .filelist div.file-panel {
position: absolute;
height: 0;
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#80000000', endColorstr='#80000000') \0;
background: rgba(0, 0, 0, 0.5);
width: 100%;
top: 0;
left: 0;
overflow: hidden;
z-index: 300;
}
#upload .filelist div.file-panel span {
width: 24px;
height: 24px;
display: inline;
float: right;
text-indent: -9999px;
overflow: hidden;
background: url(./images/icons.png) no-repeat;
background: url(./images/icons.gif) no-repeat \9;
margin: 5px 1px 1px;
cursor: pointer;
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#upload .filelist div.file-panel span.rotateLeft {
display:none;
background-position: 0 -24px;
}
#upload .filelist div.file-panel span.rotateLeft:hover {
background-position: 0 0;
}
#upload .filelist div.file-panel span.rotateRight {
display:none;
background-position: -24px -24px;
}
#upload .filelist div.file-panel span.rotateRight:hover {
background-position: -24px 0;
}
#upload .filelist div.file-panel span.cancel {
background-position: -48px -24px;
}
#upload .filelist div.file-panel span.cancel:hover {
background-position: -48px 0;
}
#upload .statusBar {
height: 45px;
border-bottom: 1px solid #dadada;
margin: 0 10px;
padding: 0;
line-height: 45px;
vertical-align: middle;
position: relative;
}
#upload .statusBar .progress {
border: 1px solid #1483d8;
width: 198px;
background: #fff;
height: 18px;
position: absolute;
top: 12px;
display: none;
text-align: center;
line-height: 18px;
color: #6dbfff;
margin: 0 10px 0 0;
}
#upload .statusBar .progress span.percentage {
width: 0;
height: 100%;
left: 0;
top: 0;
background: #1483d8;
position: absolute;
}
#upload .statusBar .progress span.text {
position: relative;
z-index: 10;
}
#upload .statusBar .info {
display: inline-block;
font-size: 14px;
color: #666666;
}
#upload .statusBar .btns {
position: absolute;
top: 7px;
right: 0;
line-height: 30px;
}
#filePickerBtn {
display: inline-block;
float: left;
}
#upload .statusBar .btns .webuploader-pick,
#upload .statusBar .btns .uploadBtn,
#upload .statusBar .btns .uploadBtn.state-uploading,
#upload .statusBar .btns .uploadBtn.state-paused {
background: #ffffff;
border: 1px solid #cfcfcf;
color: #565656;
padding: 0 18px;
display: inline-block;
border-radius: 3px;
margin-left: 10px;
cursor: pointer;
font-size: 14px;
float: left;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#upload .statusBar .btns .webuploader-pick-hover,
#upload .statusBar .btns .uploadBtn:hover,
#upload .statusBar .btns .uploadBtn.state-uploading:hover,
#upload .statusBar .btns .uploadBtn.state-paused:hover {
background: #f0f0f0;
}
#upload .statusBar .btns .uploadBtn,
#upload .statusBar .btns .uploadBtn.state-paused{
background: #00b7ee;
color: #fff;
border-color: transparent;
}
#upload .statusBar .btns .uploadBtn:hover,
#upload .statusBar .btns .uploadBtn.state-paused:hover{
background: #00a2d4;
}
#upload .statusBar .btns .uploadBtn.disabled {
pointer-events: none;
filter:alpha(opacity=60);
-moz-opacity:0.6;
-khtml-opacity: 0.6;
opacity: 0.6;
}
/* 图片管理样式 */
#online {
width: 100%;
height: 336px;
padding: 10px 0 0 0;
}
#online #imageList{
width: 100%;
height: 100%;
overflow-x: hidden;
overflow-y: auto;
position: relative;
}
#online ul {
display: block;
list-style: none;
margin: 0;
padding: 0;
}
#online li {
float: left;
display: block;
list-style: none;
padding: 0;
width: 113px;
height: 113px;
margin: 0 0 9px 9px;
*margin: 0 0 6px 6px;
background-color: #eee;
overflow: hidden;
cursor: pointer;
position: relative;
}
#online li.clearFloat {
float: none;
clear: both;
display: block;
width:0;
height:0;
margin: 0;
padding: 0;
}
#online li img {
cursor: pointer;
}
#online li .icon {
cursor: pointer;
width: 113px;
height: 113px;
position: absolute;
top: 0;
left: 0;
z-index: 2;
border: 0;
background-repeat: no-repeat;
}
#online li .icon:hover {
width: 107px;
height: 107px;
border: 3px solid #1094fa;
}
#online li.selected .icon {
background-image: url(images/success.png);
background-image: url(images/success.gif)\9;
background-position: 75px 75px;
}
#online li.selected .icon:hover {
width: 107px;
height: 107px;
border: 3px solid #1094fa;
background-position: 72px 72px;
}
/* 图片搜索样式 */
#search .searchBar {
width: 100%;
height: 30px;
margin: 10px 0 5px 0;
padding: 0;
}
#search input.text{
width: 150px;
padding: 3px 6px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
#search input.text:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
}
#search input.searchTxt {
margin-left:5px;
padding-left: 5px;
background: #FFF;
width: 300px;
*width: 260px;
height: 21px;
line-height: 21px;
float: left;
dislay: block;
}
#search .searchType {
width: 65px;
height: 28px;
padding:0;
line-height: 28px;
border: 1px solid #d7d7d7;
border-radius: 0;
vertical-align: top;
margin-left: 5px;
float: left;
dislay: block;
}
#search #searchBtn,
#search #searchReset {
display: inline-block;
margin-bottom: 0;
margin-right: 5px;
padding: 4px 10px;
font-weight: 400;
text-align: center;
vertical-align: middle;
cursor: pointer;
background-image: none;
border: 1px solid transparent;
white-space: nowrap;
font-size: 14px;
border-radius: 4px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
vertical-align: top;
float: right;
}
#search #searchBtn {
color: white;
border-color: #285e8e;
background-color: #3b97d7;
}
#search #searchReset {
color: #333;
border-color: #ccc;
background-color: #fff;
}
#search #searchBtn:hover {
background-color: #3276b1;
}
#search #searchReset:hover {
background-color: #eee;
}
#search .msg {
margin-left: 5px;
}
#search .searchList{
width: 100%;
height: 300px;
overflow: hidden;
clear: both;
}
#search .searchList ul{
margin:0;
padding:0;
list-style:none;
clear: both;
width: 100%;
height: 100%;
overflow-x: hidden;
overflow-y: auto;
zoom: 1;
position: relative;
}
#search .searchList li {
list-style:none;
float: left;
display: block;
width: 115px;
margin: 5px 10px 5px 20px;
*margin: 5px 10px 5px 15px;
padding:0;
font-size: 12px;
box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
position: relative;
vertical-align: top;
text-align: center;
overflow: hidden;
cursor: pointer;
filter: alpha(Opacity=100);
-moz-opacity: 1;
opacity: 1;
border: 2px solid #eee;
}
#search .searchList li.selected {
filter: alpha(Opacity=40);
-moz-opacity: 0.4;
opacity: 0.4;
border: 2px solid #00a0e9;
}
#search .searchList li p {
background-color: #eee;
margin: 0;
padding: 0;
position: relative;
width:100%;
height:115px;
overflow: hidden;
}
#search .searchList li p img {
cursor: pointer;
border: 0;
}
#search .searchList li a {
color: #999;
border-top: 1px solid #F2F2F2;
background: #FAFAFA;
text-align: center;
display: block;
padding: 0 5px;
width: 105px;
height:32px;
line-height:32px;
white-space:nowrap;
text-overflow:ellipsis;
text-decoration: none;
overflow: hidden;
word-break: break-all;
}
#search .searchList a:hover {
text-decoration: underline;
color: #333;
}
#search .searchList .clearFloat{
clear: both;
}

View File

@@ -0,0 +1,121 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>ueditor图片对话框</title>
<script type="text/javascript" src="../internal.js"></script>
<!-- jquery -->
<script type="text/javascript" src="../../third-party/jquery-1.10.2.min.js"></script>
<!-- webuploader -->
<script src="../../third-party/webuploader/webuploader.min.js"></script>
<link rel="stylesheet" type="text/css" href="../../third-party/webuploader/webuploader.css">
<!-- image dialog -->
<link rel="stylesheet" href="image.css" type="text/css" />
</head>
<body>
<div class="wrapper">
<div id="tabhead" class="tabhead">
<!--xlz去掉线上上传图片的功能-->
<!-- <span class="tab" data-content-id="remote"><var id="lang_tab_remote"></var></span>-->
<span class="tab focus" data-content-id="upload"><var id="lang_tab_upload"></var></span>
<!--<span class="tab" data-content-id="online"><var id="lang_tab_online"></var></span>
<span class="tab" data-content-id="search"><var id="lang_tab_search"></var></span>-->
</div>
<div class="alignBar">
<label class="algnLabel"><var id="lang_input_align"></var></label>
<span id="alignIcon">
<span id="noneAlign" class="none-align focus" data-align="none"></span>
<span id="leftAlign" class="left-align" data-align="left"></span>
<span id="rightAlign" class="right-align" data-align="right"></span>
<span id="centerAlign" class="center-align" data-align="center"></span>
</span>
<input id="align" name="align" type="hidden" value="none"/>
</div>
<div id="tabbody" class="tabbody">
<!-- 远程图片 -->
<div id="remote" class="panel">
<div class="top">
<div class="row">
<label for="url"><var id="lang_input_url"></var></label>
<span><input class="text" id="url" type="text"/></span>
</div>
</div>
<div class="left">
<div class="row">
<label><var id="lang_input_size"></var></label>
<span><var id="lang_input_width">&nbsp;&nbsp;</var><input class="text" type="text" id="width"/>px </span>
<span><var id="lang_input_height">&nbsp;&nbsp;</var><input class="text" type="text" id="height"/>px </span>
<span><input id="lock" type="checkbox" disabled="disabled"><span id="lockicon"></span></span>
</div>
<div class="row">
<label><var id="lang_input_border"></var></label>
<span><input class="text" type="text" id="border"/>px </span>
</div>
<div class="row">
<label><var id="lang_input_vhspace"></var></label>
<span><input class="text" type="text" id="vhSpace"/>px </span>
</div>
<div class="row">
<label><var id="lang_input_title"></var></label>
<span><input class="text" type="text" id="title"/></span>
</div>
</div>
<div class="right"><div id="preview"></div></div>
</div>
<!-- 上传图片 -->
<div id="upload" class="panel focus">
<div id="queueList" class="queueList">
<div class="statusBar element-invisible">
<div class="progress">
<span class="text">0%</span>
<span class="percentage"></span>
</div><div class="info"></div>
<div class="btns">
<div id="filePickerBtn"></div>
<div class="uploadBtn"><var id="lang_start_upload"></var></div>
</div>
</div>
<div id="dndArea" class="placeholder">
<div class="filePickerContainer">
<div id="filePickerReady"></div>
</div>
</div>
<ul class="filelist element-invisible">
<li id="filePickerBlock" class="filePickerBlock"></li>
</ul>
</div>
</div>
<!-- 在线图片 -->
<div id="online" class="panel">
<div id="imageList"><var id="lang_imgLoading"></var></div>
</div>
<!-- 搜索图片 -->
<div id="search" class="panel">
<div class="searchBar">
<input id="searchTxt" class="searchTxt text" type="text" />
<select id="searchType" class="searchType">
<option value="&s=4&z=0"></option>
<option value="&s=1&z=19"></option>
<option value="&s=2&z=0"></option>
<option value="&s=3&z=0"></option>
</select>
<input id="searchReset" type="button" />
<input id="searchBtn" type="button" />
</div>
<div id="searchList" class="searchList"><ul id="searchListUl"></ul></div>
</div>
</div>
</div>
<script type="text/javascript" src="image.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -0,0 +1,81 @@
(function () {
var parent = window.parent;
//dialog对象
dialog = parent.$EDITORUI[window.frameElement.id.replace( /_iframe$/, '' )];
//当前打开dialog的编辑器实例
editor = dialog.editor;
UE = parent.UE;
domUtils = UE.dom.domUtils;
utils = UE.utils;
browser = UE.browser;
ajax = UE.ajax;
$G = function ( id ) {
return document.getElementById( id )
};
//focus元素
$focus = function ( node ) {
setTimeout( function () {
if ( browser.ie ) {
var r = node.createTextRange();
r.collapse( false );
r.select();
} else {
node.focus()
}
}, 0 )
};
utils.loadFile(document,{
href: "../themes/default/dialogbase.css?cache="+Math.random(),//xlz原来的路径写错了去掉了一个../
tag:"link",
type:"text/css",
// rel:"stylesheet"
});
lang = editor.getLang(dialog.className.split( "-" )[2]);
if(lang){
domUtils.on(window,'load',function () {
var langImgPath = editor.options.langPath + editor.options.lang + "/images/";
//针对静态资源
for ( var i in lang["static"] ) {
var dom = $G( i );
if(!dom) continue;
var tagName = dom.tagName,
content = lang["static"][i];
if(content.src){
//clone
content = utils.extend({},content,false);
content.src = langImgPath + content.src;
}
if(content.style){
content = utils.extend({},content,false);
content.style = content.style.replace(/url\s*\(/g,"url(" + langImgPath)
}
switch ( tagName.toLowerCase() ) {
case "var":
dom.parentNode.replaceChild( document.createTextNode( content ), dom );
break;
case "select":
var ops = dom.options;
for ( var j = 0, oj; oj = ops[j]; ) {
oj.innerHTML = content.options[j++];
}
for ( var p in content ) {
p != "options" && dom.setAttribute( p, content[p] );
}
break;
default :
domUtils.setAttributes( dom, content);
}
}
} );
}
})();

View File

@@ -0,0 +1,40 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
html,body{
height:100%;
width:100%;
padding:0;
margin:0;
}
#preview{
width:100%;
height:100%;
padding:0;
margin:0;
}
#preview *{font-family:sans-serif;font-size:16px;}
</style>
<script type="text/javascript" src="../internal.js"></script>
<script src="../../ueditor.parse.min.js"></script>
<title></title>
</head>
<body class="view">
<div id="preview" style="margin:8px">
</div>
</body>
<script>
document.getElementById('preview').innerHTML = editor.getContent();
uParse('#preview',{
rootPath : '../../',
chartContainerHeight:500
})
dialog.oncancel = function(){
document.getElementById('preview').innerHTML = '';
}
</script>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

View File

@@ -0,0 +1,84 @@
body{
overflow: hidden;
width: 540px;
}
.wrapper {
margin: 10px auto 0;
font-size: 12px;
overflow: hidden;
width: 520px;
height: 315px;
}
.clear {
clear: both;
}
.wrapper .left {
float: left;
margin-left: 10px;;
}
.wrapper .right {
float: right;
border-left: 2px dotted #EDEDED;
padding-left: 15px;
}
.section {
margin-bottom: 15px;
width: 240px;
overflow: hidden;
}
.section h3 {
font-weight: bold;
padding: 5px 0;
margin-bottom: 10px;
border-bottom: 1px solid #EDEDED;
font-size: 12px;
}
.section ul {
list-style: none;
overflow: hidden;
clear: both;
}
.section li {
float: left;
width: 120px;;
}
.section .tone {
width: 80px;;
}
.section .preview {
width: 220px;
}
.section .preview table {
text-align: center;
vertical-align: middle;
color: #666;
}
.section .preview caption {
font-weight: bold;
}
.section .preview td {
border-width: 1px;
border-style: solid;
height: 22px;
}
.section .preview th {
border-style: solid;
border-color: #DDD;
border-width: 2px 1px 1px 1px;
height: 22px;
background-color: #F7F7F7;
}

View File

@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="../internal.js"></script>
<link rel="stylesheet" type="text/css" href="edittable.css">
</head>
<body>
<div class="wrapper">
<div class="left">
<div class="section">
<h3><var id="lang_tableStyle"></var></h3>
<ul>
<li>
<label onselectstart="return false"><input type="checkbox" id="J_title" name="style"/><var id="lang_insertTitle"></var></label>
</li>
<li>
<label onselectstart="return false"><input type="checkbox" id="J_titleCol" name="style"/><var id="lang_insertTitleCol"></var></label>
</li>
</ul>
<ul>
<li>
<label onselectstart="return false"><input type="checkbox" id="J_caption" name="style"/><var id="lang_insertCaption"></var></label>
</li>
<li>
<label onselectstart="return false"><input type="checkbox" id="J_sorttable" name="style"/><var id="lang_orderbycontent"></var></label>
</li>
</ul>
<div class="clear"></div>
</div>
<div class="section">
<h3><var id="lang_tableSize"></var></h3>
<ul>
<li>
<label><input type="radio" id="J_autoSizeContent" name="size"/><var id="lang_autoSizeContent"></var></label>
</li>
<li>
<label><input type="radio" id="J_autoSizePage" name="size"/><var id="lang_autoSizePage"></var></label>
</li>
</ul>
<div class="clear"></div>
</div>
<div class="section">
<h3><var id="lang_borderStyle"></var></h3>
<ul>
<li>
<span><var id="lang_color"></var></span>
<input type="text" class="tone" id="J_tone" readonly='readonly' />
</li>
</ul>
<div class="clear"></div>
</div>
</div>
<div class="right">
<div class="section">
<h3><var id="lang_example"></var></h3>
<div class="preview" id="J_preview">
</div>
</div>
</div>
</div>
<script type="text/javascript" src="edittable.js"></script>
</body>
</html>

View File

@@ -0,0 +1,237 @@
/**
* Created with JetBrains PhpStorm.
* User: xuheng
* Date: 12-12-19
* Time: 下午4:55
* To change this template use File | Settings | File Templates.
*/
(function () {
var title = $G("J_title"),
titleCol = $G("J_titleCol"),
caption = $G("J_caption"),
sorttable = $G("J_sorttable"),
autoSizeContent = $G("J_autoSizeContent"),
autoSizePage = $G("J_autoSizePage"),
tone = $G("J_tone"),
me,
preview = $G("J_preview");
var editTable = function () {
me = this;
me.init();
};
editTable.prototype = {
init:function () {
var colorPiker = new UE.ui.ColorPicker({
editor:editor
}),
colorPop = new UE.ui.Popup({
editor:editor,
content:colorPiker
});
title.checked = editor.queryCommandState("inserttitle") == -1;
titleCol.checked = editor.queryCommandState("inserttitlecol") == -1;
caption.checked = editor.queryCommandState("insertcaption") == -1;
sorttable.checked = editor.queryCommandState("enablesort") == 1;
var enablesortState = editor.queryCommandState("enablesort"),
disablesortState = editor.queryCommandState("disablesort");
sorttable.checked = !!(enablesortState < 0 && disablesortState >=0);
sorttable.disabled = !!(enablesortState < 0 && disablesortState < 0);
sorttable.title = enablesortState < 0 && disablesortState < 0 ? lang.errorMsg:'';
me.createTable(title.checked, titleCol.checked, caption.checked);
me.setAutoSize();
me.setColor(me.getColor());
domUtils.on(title, "click", me.titleHanler);
domUtils.on(titleCol, "click", me.titleColHanler);
domUtils.on(caption, "click", me.captionHanler);
domUtils.on(sorttable, "click", me.sorttableHanler);
domUtils.on(autoSizeContent, "click", me.autoSizeContentHanler);
domUtils.on(autoSizePage, "click", me.autoSizePageHanler);
domUtils.on(tone, "click", function () {
colorPop.showAnchor(tone);
});
domUtils.on(document, 'mousedown', function () {
colorPop.hide();
});
colorPiker.addListener("pickcolor", function () {
me.setColor(arguments[1]);
colorPop.hide();
});
colorPiker.addListener("picknocolor", function () {
me.setColor("");
colorPop.hide();
});
},
createTable:function (hasTitle, hasTitleCol, hasCaption) {
var arr = [],
sortSpan = '<span>^</span>';
arr.push("<table id='J_example'>");
if (hasCaption) {
arr.push("<caption>" + lang.captionName + "</caption>")
}
if (hasTitle) {
arr.push("<tr>");
if(hasTitleCol) { arr.push("<th>" + lang.titleName + "</th>"); }
for (var j = 0; j < 5; j++) {
arr.push("<th>" + lang.titleName + "</th>");
}
arr.push("</tr>");
}
for (var i = 0; i < 6; i++) {
arr.push("<tr>");
if(hasTitleCol) { arr.push("<th>" + lang.titleName + "</th>") }
for (var k = 0; k < 5; k++) {
arr.push("<td>" + lang.cellsName + "</td>")
}
arr.push("</tr>");
}
arr.push("</table>");
preview.innerHTML = arr.join("");
this.updateSortSpan();
},
titleHanler:function () {
var example = $G("J_example"),
frg=document.createDocumentFragment(),
color = domUtils.getComputedStyle(domUtils.getElementsByTagName(example, "td")[0], "border-color"),
colCount = example.rows[0].children.length;
if (title.checked) {
example.insertRow(0);
for (var i = 0, node; i < colCount; i++) {
node = document.createElement("th");
node.innerHTML = lang.titleName;
frg.appendChild(node);
}
example.rows[0].appendChild(frg);
} else {
domUtils.remove(example.rows[0]);
}
me.setColor(color);
me.updateSortSpan();
},
titleColHanler:function () {
var example = $G("J_example"),
color = domUtils.getComputedStyle(domUtils.getElementsByTagName(example, "td")[0], "border-color"),
colArr = example.rows,
colCount = colArr.length;
if (titleCol.checked) {
for (var i = 0, node; i < colCount; i++) {
node = document.createElement("th");
node.innerHTML = lang.titleName;
colArr[i].insertBefore(node, colArr[i].children[0]);
}
} else {
for (var i = 0; i < colCount; i++) {
domUtils.remove(colArr[i].children[0]);
}
}
me.setColor(color);
me.updateSortSpan();
},
captionHanler:function () {
var example = $G("J_example");
if (caption.checked) {
var row = document.createElement('caption');
row.innerHTML = lang.captionName;
example.insertBefore(row, example.firstChild);
} else {
domUtils.remove(domUtils.getElementsByTagName(example, 'caption')[0]);
}
},
sorttableHanler:function(){
me.updateSortSpan();
},
autoSizeContentHanler:function () {
var example = $G("J_example");
example.removeAttribute("width");
},
autoSizePageHanler:function () {
var example = $G("J_example");
var tds = example.getElementsByTagName(example, "td");
utils.each(tds, function (td) {
td.removeAttribute("width");
});
example.setAttribute('width', '100%');
},
updateSortSpan: function(){
var example = $G("J_example"),
row = example.rows[0];
var spans = domUtils.getElementsByTagName(example,"span");
utils.each(spans,function(span){
span.parentNode.removeChild(span);
});
if (sorttable.checked) {
utils.each(row.cells, function(cell, i){
var span = document.createElement("span");
span.innerHTML = "^";
cell.appendChild(span);
});
}
},
getColor:function () {
var start = editor.selection.getStart(), color,
cell = domUtils.findParentByTagName(start, ["td", "th", "caption"], true);
color = cell && domUtils.getComputedStyle(cell, "border-color");
if (!color) color = "#DDDDDD";
return color;
},
setColor:function (color) {
var example = $G("J_example"),
arr = domUtils.getElementsByTagName(example, "td").concat(
domUtils.getElementsByTagName(example, "th"),
domUtils.getElementsByTagName(example, "caption")
);
tone.value = color;
utils.each(arr, function (node) {
node.style.borderColor = color;
});
},
setAutoSize:function () {
var me = this;
autoSizePage.checked = true;
me.autoSizePageHanler();
}
};
new editTable;
dialog.onok = function () {
editor.__hasEnterExecCommand = true;
var checks = {
title:"inserttitle deletetitle",
titleCol:"inserttitlecol deletetitlecol",
caption:"insertcaption deletecaption",
sorttable:"enablesort disablesort"
};
editor.fireEvent('saveScene');
for(var i in checks){
var cmds = checks[i].split(" "),
input = $G("J_" + i);
if(input["checked"]){
editor.queryCommandState(cmds[0])!=-1 &&editor.execCommand(cmds[0]);
}else{
editor.queryCommandState(cmds[1])!=-1 &&editor.execCommand(cmds[1]);
}
}
editor.execCommand("edittable", tone.value);
autoSizeContent.checked ?editor.execCommand('adaptbytext') : "";
autoSizePage.checked ? editor.execCommand("adaptbywindow") : "";
editor.fireEvent('saveScene');
editor.__hasEnterExecCommand = false;
};
})();

View File

@@ -0,0 +1,61 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="../internal.js"></script>
<style type="text/css">
.section {
text-align: center;
margin-top: 10px;
}
.section input {
margin-left: 5px;
width: 70px;
}
</style>
</head>
<body>
<div class="section">
<span><var id="lang_tdBkColor"></var></span>
<input type="text" id="J_tone"/>
</div>
<script type="text/javascript">
var tone = $G("J_tone"),
colorPiker = new UE.ui.ColorPicker({
editor:editor
}),
colorPop = new UE.ui.Popup({
editor:editor,
content:colorPiker
});
domUtils.on(tone, "click", function () {
colorPop.showAnchor(tone);
});
domUtils.on(document, 'mousedown', function () {
colorPop.hide();
});
colorPiker.addListener("pickcolor", function () {
tone.value = arguments[1];
colorPop.hide();
});
colorPiker.addListener("picknocolor", function () {
tone.value="";
colorPop.hide();
});
dialog.onok=function(){
editor.execCommand("edittd",tone.value);
};
var start = editor.selection.getStart(),
cell = start && domUtils.findParentByTagName(start, ["td", "th"], true);
if(cell){
var color = domUtils.getComputedStyle(cell,'background-color');
if(/^#/.test(color)){
tone.value = color
}
}
</script>
</body>
</html>

View File

@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<title>表格删除提示</title>
<script type="text/javascript" src="../internal.js"></script>
<style type="text/css">
.section {
width: 200px;
margin: 10px auto 0;
font-size: 14px;
}
.item {
text-align: center;
}
</style>
</head>
<body>
<div class="section">
<div class="item">
<label><input type="radio" id="J_delRow" name="cmd" checked/><var id="lang_delRow"></var></label>
</div>
<div class="item">
<label><input type="radio" id="J_delCol" name="cmd"/><var id="lang_delCol"></var></label>
</div>
</div>
<script type="text/javascript">
dialog.onok = function () {
$G("J_delRow").checked ? editor.execCommand("deleterow") : editor.execCommand("deletecol");
};
</script>
</body>
</html>

View File

@@ -0,0 +1,74 @@
UE.registerUI('kityformula', function(editor, uiname){
// 创建dialog
var kfDialog = new UE.ui.Dialog({
// 指定弹出层路径
iframeUrl: editor.options.UEDITOR_HOME_URL + 'kityformula-plugin/kityFormulaDialog.html',
// 编辑器实例
editor: editor,
// dialog 名称
name: uiname,
// dialog 标题
title: '插入公式 ',
// dialog 外围 css
cssRules: 'width:783px; height: 386px;',
//如果给出了buttons就代表dialog有确定和取消
buttons:[
{
className:'edui-okbutton',
label:'确定',
onclick:function () {
kfDialog.close(true);
}
},
{
className:'edui-cancelbutton',
label:'取消',
onclick:function () {
kfDialog.close(false);
}
}
]});
editor.ready(function(){
UE.utils.cssRule('kfformula', 'img.kfformula{vertical-align: middle;}', editor.document);
});
var iconUrl = editor.options.UEDITOR_HOME_URL + 'kityformula-plugin/kf-icon.png';
var tmpLink = document.createElement('a');
tmpLink.href = iconUrl;
tmpLink.href = tmpLink.href;
iconUrl = tmpLink.href;
var kfBtn = new UE.ui.Button({
name:'插入' + uiname,
title:'插入公式',
//需要添加的额外样式指定icon图标
cssRules :'background: url("' + iconUrl + '") !important',
onclick:function () {
//渲染dialog
kfDialog.render();
kfDialog.open();
}
});
//当点到编辑内容上时,按钮要做的状态反射
editor.addListener('selectionchange', function () {
var state = editor.queryCommandState(uiname);
if (state == -1) {
kfBtn.setDisabled(true);
kfBtn.setChecked(false);
} else {
kfBtn.setDisabled(false);
kfBtn.setChecked(state);
}
});
return kfBtn;
});

View File

@@ -0,0 +1,247 @@
///import core
///plugin 编辑器默认的过滤转换机制
UE.plugins['defaultfilter'] = function () {
var me = this;
me.setOpt({
'allowDivTransToP':true,
'disabledTableInTable':true,
'rgb2Hex':true
});
//默认的过滤处理
//进入编辑器的内容处理
me.addInputRule(function (root) {
var allowDivTransToP = this.options.allowDivTransToP;
var val;
function tdParent(node){
while(node && node.type == 'element'){
if(node.tagName == 'td'){
return true;
}
node = node.parentNode;
}
return false;
}
//进行默认的处理
root.traversal(function (node) {
if (node.type == 'element') {
if (!UE.dom.dtd.$cdata[node.tagName] && me.options.autoClearEmptyNode && UE.dom.dtd.$inline[node.tagName] && !UE.dom.dtd.$empty[node.tagName] && (!node.attrs || UE.utils.isEmptyObject(node.attrs))) {
if (!node.firstChild()) node.parentNode.removeChild(node);
else if (node.tagName == 'span' && (!node.attrs || UE.utils.isEmptyObject(node.attrs))) {
node.parentNode.removeChild(node, true)
}
return;
}
switch (node.tagName) {
case 'style':
case 'script':
node.setAttr({
cdata_tag: node.tagName,
cdata_data: (node.innerHTML() || ''),
'_ue_custom_node_':'true'
});
node.tagName = 'div';
node.innerHTML('');
break;
case 'a':
if (val = node.getAttr('href')) {
node.setAttr('_href', val)
}
break;
case 'img':
//todo base64暂时去掉后边做远程图片上传后干掉这个
// if (val = node.getAttr('src')) {
// if (/^data:/.test(val)) {
// node.parentNode.removeChild(node);
// break;
// }
// }
node.setAttr('_src', node.getAttr('src'));
break;
case 'span':
if (UE.browser.webkit && (val = node.getStyle('white-space'))) {
if (/nowrap|normal/.test(val)) {
node.setStyle('white-space', '');
if (me.options.autoClearEmptyNode && UE.utils.isEmptyObject(node.attrs)) {
node.parentNode.removeChild(node, true)
}
}
}
val = node.getAttr('id');
if(val && /^_baidu_bookmark_/i.test(val)){
node.parentNode.removeChild(node)
}
break;
case 'p':
if (val = node.getAttr('align')) {
node.setAttr('align');
node.setStyle('text-align', val)
}
//trace:3431
// var cssStyle = node.getAttr('style');
// if (cssStyle) {
// cssStyle = cssStyle.replace(/(margin|padding)[^;]+/g, '');
// node.setAttr('style', cssStyle)
//
// }
//p标签不允许嵌套
UE.utils.each(node.children,function(n){
if(n.type == 'element' && n.tagName == 'p'){
var next = n.nextSibling();
node.parentNode.insertAfter(n,node);
var last = n;
while(next){
var tmp = next.nextSibling();
node.parentNode.insertAfter(next,last);
last = next;
next = tmp;
}
return false;
}
});
if (!node.firstChild()) {
node.innerHTML(UE.browser.ie ? '&nbsp;' : '<br/>')
}
break;
case 'div':
if(node.getAttr('cdata_tag')){
break;
}
//针对代码这里不处理插入代码的div
val = node.getAttr('class');
if(val && /^line number\d+/.test(val)){
break;
}
if(!allowDivTransToP){
break;
}
var tmpNode, p = UE.uNode.createElement('p');
while (tmpNode = node.firstChild()) {
if (tmpNode.type == 'text' || !UE.dom.UE.dom.dtd.$block[tmpNode.tagName]) {
p.appendChild(tmpNode);
} else {
if (p.firstChild()) {
node.parentNode.insertBefore(p, node);
p = UE.uNode.createElement('p');
} else {
node.parentNode.insertBefore(tmpNode, node);
}
}
}
if (p.firstChild()) {
node.parentNode.insertBefore(p, node);
}
node.parentNode.removeChild(node);
break;
case 'dl':
node.tagName = 'ul';
break;
case 'dt':
case 'dd':
node.tagName = 'li';
break;
case 'li':
var className = node.getAttr('class');
if (!className || !/list\-/.test(className)) {
node.setAttr()
}
var tmpNodes = node.getNodesByTagName('ol ul');
UE.utils.each(tmpNodes, function (n) {
node.parentNode.insertAfter(n, node);
});
break;
case 'td':
case 'th':
case 'caption':
if(!node.children || !node.children.length){
node.appendChild(UE.browser.ie11below ? UE.uNode.createText(' ') : UE.uNode.createElement('br'))
}
break;
case 'table':
if(me.options.disabledTableInTable && tdParent(node)){
node.parentNode.insertBefore(UE.uNode.createText(node.innerText()),node);
node.parentNode.removeChild(node)
}
}
}
// if(node.type == 'comment'){
// node.parentNode.removeChild(node);
// }
})
});
//从编辑器出去的内容处理
me.addOutputRule(function (root) {
var val;
root.traversal(function (node) {
if (node.type == 'element') {
if (me.options.autoClearEmptyNode && UE.dom.dtd.$inline[node.tagName] && !UE.dom.dtd.$empty[node.tagName] && (!node.attrs || UE.utils.isEmptyObject(node.attrs))) {
if (!node.firstChild()) node.parentNode.removeChild(node);
else if (node.tagName == 'span' && (!node.attrs || UE.utils.isEmptyObject(node.attrs))) {
node.parentNode.removeChild(node, true)
}
return;
}
switch (node.tagName) {
case 'div':
if (val = node.getAttr('cdata_tag')) {
node.tagName = val;
node.appendChild(UE.uNode.createText(node.getAttr('cdata_data')));
node.setAttr({cdata_tag: '', cdata_data: '','_ue_custom_node_':''});
}
break;
case 'a':
if (val = node.getAttr('_href')) {
node.setAttr({
'href': UE.utils.html(val),
'_href': ''
})
}
break;
break;
case 'span':
val = node.getAttr('id');
if(val && /^_baidu_bookmark_/i.test(val)){
node.parentNode.removeChild(node)
}
//将color的rgb格式转换为#16进制格式
if(me.getOpt('rgb2Hex')){
var cssStyle = node.getAttr('style');
if(cssStyle){
node.setAttr('style',cssStyle.replace(/rgba?\(([\d,\s]+)\)/g,function(a,value){
var array = value.split(",");
if (array.length > 3)
return "";
value = "#";
for (var i = 0, color; color = array[i++];) {
color = parseInt(color.replace(/[^\d]/gi, ''), 10).toString(16);
value += color.length == 1 ? "0" + color : color;
}
return value.toUpperCase();
}))
}
}
break;
case 'img':
if (val = node.getAttr('_src')) {
node.setAttr({
'src': node.getAttr('_src'),
'_src': ''
})
}
}
}
})
});
};

View File

@@ -0,0 +1,66 @@
/**
* Created by zhangbo21 on 14-9-2.
*/
/*
* getKfContent : 将image的src从base64替换为文件名
* param : callback -- 回调函数 其参数为替换之后的内容
* return : void
* */
UE.Editor.prototype.getKfContent = function(callback){
var me = this;
var actionUrl = me.getActionUrl(me.getOpt('scrawlActionName')),
params = UE.utils.serializeParam(me.queryCommandValue('serverparam')) || '',
url = UE.utils.formatUrl(actionUrl + (actionUrl.indexOf('?') == -1 ? '?':'&') + params);
// 找到所有的base64
var count = 0;
var imgs =me.body.getElementsByTagName('img');
var base64Imgs = [];
UE.utils.each(imgs, function(item){
var imgType = item.getAttribute('src').match(/^[^;]+/)[0];
if ( imgType === 'data:image/png') {
base64Imgs.push(item);
}
});
if (base64Imgs.length == 0){
execCallback();
} else {
UE.utils.each(base64Imgs, function(item){
var opt ={};
opt[me.getOpt('scrawlFieldName')]= item.getAttribute('src').replace(/^[^,]+,/, '');
opt.onsuccess = function(xhr){
var json = UE.utils.str2json(xhr.responseText),
url = me.options.scrawlUrlPrefix + json.url;
item.setAttribute('src', url);
item.setAttribute('_src', url);
count++;
execCallback();
}
opt.onerror = function(err){
console.error(err);
count++;
execCallback();
}
UE.ajax.request(url, opt);
});
}
function execCallback(){
if (count >= base64Imgs.length) {
me.sync();
callback(me.getContent());
}
}
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -0,0 +1,107 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<link rel="stylesheet" href="kityformula/assets/styles/base.css">
<link rel="stylesheet" href="kityformula/assets/styles/ui.css">
<link rel="stylesheet" href="kityformula/assets/styles/scrollbar.css">
<style>
html, body {
padding: 0;
margin: 0;
}
.kf-editor {
width: 780px;
height: 380px;
}
#loading {
height: 32px;
width: 340px;
line-height: 32px;
position: absolute;
top: 42%;
left: 50%;
margin-left: -170px;
font-family: arial, "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
}
#loading img {
position: absolute;
}
#loading p {
display: block;
position: absolute;
left: 40px;
top: 0px;
margin: 0;
}
</style>
<title></title>
</head>
<body>
<div id="kfEditorContainer" class="kf-editor">
<div id="tips" class="tips">
sorry! Beta版本仅支持IE9及以上版本的浏览器正式版本将会支持低版本浏览器谢谢您的关注
</div>
</div>
<!--页面中一定要引入internal.js为了能直接使用当前打开dialog的实例变量-->
<!--internal.js默认是放到dialogs目录下的-->
<script type="text/javascript" src="../dialogs/internal.js"></script>
<script src="kityformula/js/jquery-1.11.0.min.js"></script>
<script src="kityformula/js/kitygraph.all.js"></script>
<script src="kityformula/js/kity-formula-render.all.js"></script>
<script src="kityformula/js/kity-formula-parser.all.min.js"></script>
<script src="kityformula/js/kityformula-editor.all.min.js"></script>
<script>
jQuery( function ($) {
if ( document.body.addEventListener ) {
$( "#tips").html('<div id="loading"><img src="kityformula/loading.gif" alt="loading" /><p>正在加载,请耐心等待...</p></div>' );
var factory = kf.EditorFactory.create( $( "#kfEditorContainer" )[ 0 ], {
render: {
fontsize: 24
},
resource: {
path: "./kityformula/resource/"
}
} );
factory.ready( function ( KFEditor ) {
$( "#tips").remove();
// this指向KFEditor
var rng = editor.selection.getRange(),
img = rng.getClosedNode(),
imgLatex = img && $(img).attr('data-latex');
this.execCommand( "render", imgLatex || "\\placeholder" );
this.execCommand( "focus" );
window.kfe = this;
} );
dialog.onok = function(){
kfe.execCommand('get.image.data', function(data){
var latex = kfe.execCommand('get.source');
editor.execCommand('inserthtml', '<img class="kfformula" src="'+ data.img +'" data-latex="' + latex + '" />');
dialog.close();
});
return false;
}
} else {
$( "#tips").css( "color", "black" );
$( "#tips").css( "padding", "10px" );
}
} );
</script>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More