Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

205 wiersze
5.3KB

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  7. <meta name="HandheldFriendly" content="True" />
  8. <title>Editor</title>
  9. <style type="text/css" media="screen">
  10. html,body {
  11. height:100%;
  12. }
  13. body {
  14. overflow: hidden;
  15. }
  16. .row {
  17. margin-left:0;
  18. margin-right:0;
  19. }
  20. .row .sp {
  21. height:150px;
  22. min-height:45px;
  23. padding-right:0;
  24. padding-left: 0;
  25. background-color: #222;
  26. border-bottom:4px solid transparent;
  27. }
  28. .row .sp.toolbar {
  29. min-height:450px;
  30. }
  31. .wrapper {
  32. width:100%;
  33. min-height: 100%;
  34. height: 100%;
  35. overflow:hidden;
  36. }
  37. .inner {
  38. overflow-y:auto;
  39. overflow-x:hidden;
  40. /*height:100%;*/
  41. min-height:100%;
  42. }
  43. .outer {
  44. border:0px #000 solid;
  45. height:100%;
  46. }
  47. .pane-settings {
  48. background: #002B36;
  49. color:#b3b1b1;
  50. position: absolute;
  51. z-index: 199;
  52. padding: 3px;
  53. font-size: 16px;
  54. opacity: .8;
  55. right: 5px;
  56. top: 0;
  57. margin: 0;
  58. }
  59. .pane-label {
  60. font-family: monospace;
  61. background: #002B36;
  62. color:#b3b1b1;
  63. position: absolute;
  64. z-index: 199;
  65. padding: 3px;
  66. font-size: 11px;
  67. opacity: .7;
  68. right: 10px;
  69. bottom: 10px;
  70. margin: 0;
  71. }
  72. .editable {
  73. float:left;
  74. margin-right:2px;
  75. border:1px #ddd solid;
  76. padding:1px;
  77. line-height: 1.5;
  78. border-radius:2px;
  79. }
  80. .toolbar
  81. {
  82. padding:3px;
  83. height:28px;
  84. }
  85. ::-webkit-scrollbar {
  86. width: 0.9em;
  87. }
  88. ::-webkit-scrollbar-track {
  89. box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  90. }
  91. ::-webkit-scrollbar-thumb {
  92. background: rgba(100, 100, 100, 0.7);
  93. }
  94. ::-webkit-scrollbar-corner,
  95. ::-webkit-scrollbar-thumb:window-inactive {
  96. background: rgba(100, 100, 100, 0.4);
  97. }
  98. .ace_autocomplete {
  99. width: 270px;
  100. z-index: 200000;
  101. background: #666;
  102. color: #eee;
  103. border: 0 lightgray solid;
  104. position: fixed;
  105. box-shadow: 2px 3px 5px rgba(0,0,0,.2);
  106. line-height: 1.4;
  107. }
  108. </style>
  109. </head>
  110. <body>
  111. <div class="wrapper">
  112. <div class="outer">
  113. <div class="row">
  114. <div class="col-sm-12 sp toolbar tab-pane" id="htmPane">
  115. <div class="toolbar">
  116. <button id="btnSave" class="btn btn-primary btn-xs">save</button>
  117. <button id="btnUndo" class="btn btn-primary btn-xs">undo</button>
  118. <button id="btnRedo" class="btn btn-primary btn-xs">redo</button>
  119. </div>
  120. <div class="inner" id="editor"></div>
  121. </div>
  122. </div><!--/row-->
  123. </div><!--/outer-->
  124. </div><!--/wrapper-->
  125. <script src="src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
  126. <script>
  127. var buildDom = ace.require("ace/lib/dom").buildDom;
  128. var editor = ace.edit("editor");
  129. editor.setOptions({
  130. mode: "ace/mode/text",
  131. theme: "ace/theme/twilight",
  132. showPrintMargin: false,
  133. wrap: true,
  134. indentedSoftWrap: true,
  135. showFoldWidgets: false,
  136. showLineNumbers: true,
  137. showGutter: false,
  138. autoScrollEditorIntoView: true
  139. });
  140. var refs = {};
  141. function updateToolbar() {
  142. refs.undoButton.disabled = !editor.session.getUndoManager().hasUndo();
  143. refs.redoButton.disabled = !editor.session.getUndoManager().hasRedo();
  144. }
  145. editor.on("input", updateToolbar);
  146. if (localStorage.getItem("acetest") !== null) {
  147. editor.setValue(localStorage.getItem("acetest"));
  148. editor.clearSelection();
  149. }
  150. editor.getSession().on('change', function () {
  151. localStorage.setItem("acetest", editor.getSession().getValue());
  152. });
  153. function save() {
  154. alert("not yet implemented");
  155. }
  156. editor.commands.addCommand({
  157. name: "save",
  158. exec: save,
  159. bindKey: {
  160. win: "ctrl-s",
  161. mac: "cmd-s"
  162. }
  163. });
  164. $('#btnSave').click(function(){
  165. save();
  166. });
  167. $('#btnUndo').click(function(){
  168. editor.undo();
  169. });
  170. $('#btnRow').click(function(){
  171. editor.redo();
  172. });
  173. window.editor = editor;
  174. </script>
  175. </body>
  176. </html>