懒羊羊
2023-08-30 1ac2bc1590406d9babec036e154d8d08f34a6aa1
提交 | 用户 | 时间
1ac2bc 1 <!DOCTYPE html>
2 <html>
3 <head>
4     <title></title>
5     <script type="text/javascript" src="../internal.js"></script>
6     <style type="text/css">
7         .section {
8             text-align: center;
9             margin-top: 10px;
10         }
11         .section input {
12             margin-left: 5px;
13             width: 70px;
14         }
15     </style>
16 </head>
17 <body>
18 <div class="section">
19     <span><var id="lang_tdBkColor"></var></span>
20     <input type="text" id="J_tone"/>
21 </div>
22 <script type="text/javascript">
23     var tone = $G("J_tone"),
24             colorPiker = new UE.ui.ColorPicker({
25                 editor:editor
26             }),
27             colorPop = new UE.ui.Popup({
28                 editor:editor,
29                 content:colorPiker
30             });
31     domUtils.on(tone, "click", function () {
32         colorPop.showAnchor(tone);
33     });
34     domUtils.on(document, 'mousedown', function () {
35         colorPop.hide();
36     });
37     colorPiker.addListener("pickcolor", function () {
38         tone.value = arguments[1];
39         colorPop.hide();
40     });
41     colorPiker.addListener("picknocolor", function () {
42         tone.value="";
43         colorPop.hide();
44     });
45     dialog.onok=function(){
46         editor.execCommand("edittd",tone.value);
47     };
48
49     var start = editor.selection.getStart(),
50         cell = start && domUtils.findParentByTagName(start, ["td", "th"], true);
51     if(cell){
52         var color = domUtils.getComputedStyle(cell,'background-color');
53         if(/^#/.test(color)){
54             tone.value = color
55         }
56
57     }
58
59 </script>
60 </body>
61 </html>