新增可自定义表格宽度
This commit is contained in:
parent
d4db130917
commit
9ff340e303
@ -39,9 +39,16 @@
|
||||
<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>
|
||||
<label><input type="radio" id="J_autoSizePage" name="size"/><var id="lang_autoSizePage"></var></label>
|
||||
</li>
|
||||
<!--设置自定义宽度 start-->
|
||||
<li>
|
||||
<label><input type="radio" id="J_setSizePage" name="size" />自定义页面宽度</label>
|
||||
</li>
|
||||
<li>
|
||||
<input id="J_setText" type="text" style="display:none;width:60px;" value="40%" onchange="SetText(this)"/>
|
||||
</li>
|
||||
<!--end-->
|
||||
</ul>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
@ -12,6 +12,8 @@
|
||||
sorttable = $G("J_sorttable"),
|
||||
autoSizeContent = $G("J_autoSizeContent"),
|
||||
autoSizePage = $G("J_autoSizePage"),
|
||||
setSizePage = $G("J_setSizePage"),//设置自定义宽度
|
||||
setSizeText = $G("J_setText"),//设置自定义宽度
|
||||
tone = $G("J_tone"),
|
||||
me,
|
||||
preview = $G("J_preview");
|
||||
@ -52,6 +54,7 @@
|
||||
domUtils.on(sorttable, "click", me.sorttableHanler);
|
||||
domUtils.on(autoSizeContent, "click", me.autoSizeContentHanler);
|
||||
domUtils.on(autoSizePage, "click", me.autoSizePageHanler);
|
||||
domUtils.on(setSizePage, "click", me.setSizePageHanler);//设置自定义宽度
|
||||
|
||||
domUtils.on(tone, "click", function () {
|
||||
colorPop.showAnchor(tone);
|
||||
@ -157,6 +160,8 @@
|
||||
autoSizeContentHanler: function () {
|
||||
var example = $G("J_example");
|
||||
example.removeAttribute("width");
|
||||
var txtSize = $G("J_setText");
|
||||
txtSize.style.display = "none";
|
||||
},
|
||||
autoSizePageHanler: function () {
|
||||
var example = $G("J_example");
|
||||
@ -165,6 +170,18 @@
|
||||
td.removeAttribute("width");
|
||||
});
|
||||
example.setAttribute('width', '100%');
|
||||
var txtSize = $G("J_setText");
|
||||
txtSize.style.display = "none";
|
||||
},
|
||||
setSizePageHanler: function () { //设置自定义宽度
|
||||
var example = $G("J_example");
|
||||
var txtSize = $G("J_setText");
|
||||
txtSize.style.display = "block";
|
||||
var tds = example.getElementsByTagName(example, "td");
|
||||
utils.each(tds, function (td) {
|
||||
td.removeAttribute("width");
|
||||
});
|
||||
example.setAttribute('width', txtSize.value);
|
||||
},
|
||||
updateSortSpan: function () {
|
||||
var example = $G("J_example"),
|
||||
@ -230,7 +247,10 @@
|
||||
editor.queryCommandState(cmds[1]) != -1 && editor.execCommand(cmds[1]);
|
||||
}
|
||||
}
|
||||
|
||||
//设置自定义宽度
|
||||
if (setSizePage.checked) {
|
||||
editor.execCommand("settablesize", setSizeText.value);
|
||||
}
|
||||
editor.execCommand("edittable", tone.value);
|
||||
autoSizeContent.checked ? editor.execCommand('adaptbytext') : "";
|
||||
autoSizePage.checked ? editor.execCommand("adaptbywindow") : "";
|
||||
|
@ -25528,15 +25528,39 @@ UE.plugins["audio"] = function () {
|
||||
}
|
||||
};
|
||||
|
||||
UE.commands["adaptbytext"] = UE.commands["adaptbywindow"] = {
|
||||
// UE.commands["adaptbytext"] = UE.commands["adaptbywindow"] = {
|
||||
// queryCommandState: function () {
|
||||
// return getTableItemsByRange(this).table ? 0 : -1;
|
||||
// },
|
||||
// execCommand: function (cmd) {
|
||||
// var tableItems = getTableItemsByRange(this),
|
||||
// table = tableItems.table;
|
||||
// if (table) {
|
||||
// if (cmd == "adaptbywindow") {
|
||||
// resetTdWidth(table, this);
|
||||
// } else {
|
||||
// var cells = domUtils.getElementsByTagName(table, "td th");
|
||||
// utils.each(cells, function (cell) {
|
||||
// cell.removeAttribute("width");
|
||||
// });
|
||||
// table.removeAttribute("width");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
|
||||
//修改表格属性 宽度设置
|
||||
UE.commands["adaptbytext"] =
|
||||
UE.commands["adaptbywindow"] = {
|
||||
queryCommandState: function () {
|
||||
return getTableItemsByRange(this).table ? 0 : -1;
|
||||
return getTableItemsByRange(this).table ? 0 : -1
|
||||
},
|
||||
execCommand: function (cmd) {
|
||||
var tableItems = getTableItemsByRange(this),
|
||||
table = tableItems.table;
|
||||
if (table) {
|
||||
if (cmd == "adaptbywindow") {
|
||||
if (cmd == 'adaptbywindow') {
|
||||
table.removeAttribute("width");
|
||||
resetTdWidth(table, this);
|
||||
} else {
|
||||
var cells = domUtils.getElementsByTagName(table, "td th");
|
||||
@ -25544,6 +25568,7 @@ UE.plugins["audio"] = function () {
|
||||
cell.removeAttribute("width");
|
||||
});
|
||||
table.removeAttribute("width");
|
||||
table.width = "100%";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -25778,6 +25803,19 @@ UE.plugins["audio"] = function () {
|
||||
}
|
||||
}
|
||||
};
|
||||
//表格属性 宽度设置
|
||||
UE.commands['settablesize'] = {
|
||||
queryCommandState: function () {
|
||||
return getTableItemsByRange(this).table ? 0 : -1
|
||||
},
|
||||
execCommand: function (cmd, width) {
|
||||
var rng = this.selection.getRange(),
|
||||
table = domUtils.findParentByTagName(rng.startContainer, 'table');
|
||||
if (table) {
|
||||
table.width = width;
|
||||
}
|
||||
}
|
||||
};
|
||||
//单元格属性
|
||||
UE.commands["edittd"] = {
|
||||
queryCommandState: function () {
|
||||
|
Loading…
Reference in New Issue
Block a user