懒羊羊
2023-08-30 1ac2bc1590406d9babec036e154d8d08f34a6aa1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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>