Commit e3ea5e8cc8a296ccf37e48fbd8b3feb73163f183
- Diff rendering mode:
- inline
- side by side
server/stylesheet.css
(41 / 0)
  | |||
67 | 67 | font-size:20px; | |
68 | 68 | font-weight:bold; | |
69 | 69 | } | |
70 | |||
71 | #editoroverlay { | ||
72 | display: none; | ||
73 | } | ||
74 | #editoroverlay label { | ||
75 | position: absolute; | ||
76 | top: 5%; | ||
77 | color: #000; | ||
78 | font-size: 25px; | ||
79 | } | ||
80 | |||
81 | #reference { | ||
82 | position: absolute; | ||
83 | top: 15%; | ||
84 | left:4%; | ||
85 | min-width:450px; | ||
86 | max-width:450px; | ||
87 | min-height:370px; | ||
88 | max-height:370px; | ||
89 | text-align:justify; | ||
90 | color:#000; | ||
91 | font-weight:normal; | ||
92 | } | ||
93 | #editor { | ||
94 | position:absolute; | ||
95 | top:15%; | ||
96 | left:51%; | ||
97 | min-width:450px; | ||
98 | max-width:450px; | ||
99 | min-height:370px; | ||
100 | max-height:370px; | ||
101 | font-size:15; | ||
102 | text-align:justify; | ||
103 | color:#000; | ||
104 | font-weight:normal; | ||
105 | } | ||
106 | #forprevData { | ||
107 | display:none; | ||
108 | height:1px; | ||
109 | width:1px; | ||
110 | } |
server/wsgi/pageEditor.js
(53 / 29)
  | |||
1 | 1 | ||
2 | 2 | var pageEditor = { | |
3 | template : '<div id="editoroverlay" title="Editor" alipielements="alipi" class="ui-widget-header ui-corner-all">'+ | ||
4 | '<label style="left: 20%;">Reference</label>'+ | ||
5 | '<div id="reference" readonly="yes"></div>'+ | ||
6 | '<label style="left: 70%;">Editor</label>'+ | ||
7 | '<div id="editor" alipielements="alipi" contenteditable="true"></div>'+ | ||
8 | '<div id="forPrevData"></div>'+ | ||
9 | '</div>', | ||
3 | 10 | startEdit: function(event) | |
4 | 11 | { | |
5 | 12 | if($(event.target).attr('m4pageedittype') == 'text') | |
6 | 13 | { | |
7 | event.target.removeAttribute('m4pageedittype'); | ||
8 | editor = document.createElement("div"); | ||
14 | _this = pageEditor; | ||
15 | //event.target.removeAttribute('m4pageedittype'); | ||
16 | $(event.target).removeAttr('m4pageedittype'); | ||
17 | $(body).append(_this.template); | ||
18 | /*editor = document.createElement("div"); | ||
9 | 19 | editor.setAttribute("id", "editoroverlay"); | |
10 | 20 | editor.setAttribute("title", "Edit window"); | |
11 | 21 | editor.setAttribute("alipielements", "alipi"); | |
… | … | ||
31 | 31 | refBox.setAttribute("id","reference"); | |
32 | 32 | refBox.setAttribute("readonly", 'yes'); | |
33 | 33 | refBox.setAttribute("style","position:absolute;top:15%;left:4%;min-width:450px;max-width:450px;min-height:370px;max-height:370px;text-align:justify;color:#000;font-weight:normal;"); | |
34 | editor.appendChild(refBox); | ||
35 | refBox.textContent = '<'+event.target.tagName+'>'+event.target.innerHTML+'</'+event.target.tagName+'>'; | ||
34 | editor.appendChild(refBox);*/ | ||
35 | //refBox.textContent = '<'+event.target.tagName+'>'+event.target.innerHTML+'</'+event.target.tagName+'>'; | ||
36 | var tag = event.target.nodeName; | ||
37 | $('#reference').append('<'+tag+'>'+$(event.target).html()+'</'+tag+'>'); | ||
36 | 38 | ||
37 | editLabel= document.createElement("label"); | ||
39 | /*editLabel= document.createElement("label"); | ||
38 | 40 | editLabel.innerHTML = 'Editor'; | |
39 | 41 | editLabel.setAttribute("style", "position:absolute;top:5%;left:70%;color:#000;font-size:25px;"); | |
40 | 42 | editor.appendChild(editLabel); | |
… | … | ||
46 | 46 | editBox.setAttribute("alipielements", "alipi"); | |
47 | 47 | editBox.setAttribute("contenteditable", true); | |
48 | 48 | editBox.setAttribute("style","position:absolute;top:15%;left:51%;min-width:450px;max-width:450px;min-height:370px;max-height:370px;font-size:15;text-align:justify;color:#000;font-weight:normal;"); | |
49 | editor.appendChild(editBox); | ||
50 | editBox.innerHTML = event.target.innerHTML; | ||
49 | editor.appendChild(editBox);*/ | ||
50 | //editBox.innerHTML = event.target.innerHTML; | ||
51 | $('#editor').html($(event.target).html()); | ||
51 | 52 | ||
52 | forPrevData = document.createElement("div"); | ||
53 | /*forPrevData = document.createElement("div"); | ||
53 | 54 | forPrevData.setAttribute("id","forPrevData"); | |
54 | 55 | forPrevData.setAttribute("style","display:none;height:1px;width:1px;"); | |
55 | editor.appendChild(forPrevData); | ||
56 | editor.appendChild(forPrevData);*/ | ||
56 | 57 | $( "#editoroverlay" ).dialog({ | |
57 | width:1000, | ||
58 | height:550, | ||
59 | modal: true, | ||
60 | buttons: { | ||
61 | "+": function() { | ||
62 | if(document.getElementById('editor').style.fontSize == '30px'){ | ||
58 | width:1000, | ||
59 | height:550, | ||
60 | modal: true, | ||
61 | buttons: { | ||
62 | "+": function() { | ||
63 | //if(document.getElementById('editor').style.fontSize == '30px'){ | ||
64 | if($('#editor').css('font-size') >= '30px') { | ||
63 | 65 | // passthrough | |
64 | } else { | ||
65 | document.getElementById('editor').style.fontSize = parseFloat(document.getElementById('editor').style.fontSize) + 1 + 'px'; | ||
66 | document.getElementById('reference').style.fontSize = parseFloat(document.getElementById('reference').style.fontSize) + 1 + 'px'; | ||
66 | } | ||
67 | else { | ||
68 | //document.getElementById('editor').style.fontSize = parseFloat(document.getElementById('editor').style.fontSize) + 1 + 'px'; | ||
69 | //document.getElementById('reference').style.fontSize = parseFloat(document.getElementById('reference').style.fontSize) + 1 + 'px'; | ||
70 | var font = parseFloat($('#editor').css('font-size')) + 1; | ||
71 | $('#editor').css('font-size', font+'px'); | ||
72 | font = parseFloat($('#reference').css('font-size')) + 1; | ||
73 | $('#reference').css('font-size', font+'px'); | ||
67 | 74 | } | |
68 | 75 | }, | |
69 | 76 | "-": function() { | |
70 | if(document.getElementById('editor').style.fontSize == '10px'){ | ||
71 | } else { | ||
72 | document.getElementById('editor').style.fontSize = parseFloat(document.getElementById('editor').style.fontSize) - 1 + 'px'; | ||
73 | document.getElementById('reference').style.fontSize = parseFloat(document.getElementById('reference').style.fontSize) - 1 + 'px'; | ||
77 | //if(document.getElementById('editor').style.fontSize == '10px'){ | ||
78 | if($('#editor').css('font-size') <= '10px') { | ||
79 | } | ||
80 | else { | ||
81 | //document.getElementById('editor').style.fontSize = parseFloat(document.getElementById('editor').style.fontSize) - 1 + 'px'; | ||
82 | //document.getElementById('reference').style.fontSize = parseFloat(document.getElementById('reference').style.fontSize) - 1 + 'px'; | ||
83 | var font = parseFloat($('#editor').css('font-size')) - 1; | ||
84 | $('#editor').css('font-size', font+'px'); | ||
85 | font = parseFloat($('#reference').css('font-size')) - 1; | ||
86 | $('#reference').css('font-size', font+'px'); | ||
87 | |||
74 | 88 | } | |
75 | 89 | }, | |
76 | 90 | OK: function() { | |
77 | //textElement = new TextElementPopup(pageEditor, true); | ||
78 | //textElement.textButtonOnClick(); | ||
79 | 91 | event.target.innerHTML = document.getElementById('editor').innerHTML; | |
80 | event.target.setAttribute('m4pageedittype','text'); | ||
92 | $(event.target).html($('#editor').html()); | ||
93 | $(event.target).attr('m4pageedittype','text'); | ||
81 | 94 | $( "#editoroverlay" ).remove(); | |
82 | |||
83 | } | ||
95 | } | ||
84 | 96 | }, | |
85 | 97 | close: function() { | |
86 | // document.getElementById("alipiSelectedElement").removeAttribute("id", "alipiSelectedElement"); | ||
87 | $( "#editoroverlay" ).remove(); | ||
98 | //document.getElementById("alipiSelectedElement").removeAttribute("id", "alipiSelectedElement"); | ||
99 | $("#editoroverlay" ).remove(); | ||
88 | 100 | } | |
89 | 101 | }); | |
90 | 102 | } |