TextEditor.js 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. /*
  2. * Copyright (C) 2011 Google Inc. All rights reserved.
  3. * Copyright (C) 2010 Apple Inc. All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are
  7. * met:
  8. *
  9. * * Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * * Redistributions in binary form must reproduce the above
  12. * copyright notice, this list of conditions and the following disclaimer
  13. * in the documentation and/or other materials provided with the
  14. * distribution.
  15. * * Neither the name of Google Inc. nor the names of its
  16. * contributors may be used to endorse or promote products derived from
  17. * this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  23. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  25. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. */
  31. /**
  32. * @interface
  33. */
  34. WebInspector.TextEditor = function() { };
  35. WebInspector.TextEditor.Events = {
  36. GutterClick: "gutterClick"
  37. };
  38. WebInspector.TextEditor.prototype = {
  39. /**
  40. * @return {boolean}
  41. */
  42. isClean: function() { },
  43. markClean: function() { },
  44. /*
  45. * @param {number} lineNumber
  46. * @param {number} column
  47. * @return {?{x: number, y: number, height: number}}
  48. */
  49. cursorPositionToCoordinates: function(lineNumber, column) { },
  50. /**
  51. * @param {number} x
  52. * @param {number} y
  53. * @return {?WebInspector.TextRange}
  54. */
  55. coordinatesToCursorPosition: function(x, y) { },
  56. /**
  57. * @param {number} lineNumber
  58. * @param {number} column
  59. * @return {?{startColumn: number, endColumn: number, type: string}}
  60. */
  61. tokenAtTextPosition: function(lineNumber, column) { },
  62. /**
  63. * @param {string} mimeType
  64. */
  65. set mimeType(mimeType) { },
  66. /**
  67. * @param {boolean} readOnly
  68. */
  69. setReadOnly: function(readOnly) { },
  70. /**
  71. * @return {boolean}
  72. */
  73. readOnly: function() { },
  74. /**
  75. * @return {Element}
  76. */
  77. defaultFocusedElement: function() { },
  78. /**
  79. * @param {string} regex
  80. * @param {string} cssClass
  81. * @return {Object}
  82. */
  83. highlightRegex: function(regex, cssClass) { },
  84. /**
  85. * @param {WebInspector.TextRange} range
  86. * @param {string} cssClass
  87. * @return {Object}
  88. */
  89. highlightRange: function(range, cssClass) { },
  90. /**
  91. * @param {Object} highlightDescriptor
  92. */
  93. removeHighlight: function(highlightDescriptor) { },
  94. /**
  95. * @param {number} lineNumber
  96. */
  97. revealLine: function(lineNumber) { },
  98. /**
  99. * @param {number} lineNumber
  100. * @param {boolean} disabled
  101. * @param {boolean} conditional
  102. */
  103. addBreakpoint: function(lineNumber, disabled, conditional) { },
  104. /**
  105. * @param {number} lineNumber
  106. */
  107. removeBreakpoint: function(lineNumber) { },
  108. /**
  109. * @param {number} lineNumber
  110. */
  111. setExecutionLine: function(lineNumber) { },
  112. clearExecutionLine: function() { },
  113. /**
  114. * @param {number} lineNumber
  115. * @param {Element} element
  116. */
  117. addDecoration: function(lineNumber, element) { },
  118. /**
  119. * @param {number} lineNumber
  120. * @param {Element} element
  121. */
  122. removeDecoration: function(lineNumber, element) { },
  123. /**
  124. * @param {WebInspector.TextRange} range
  125. */
  126. markAndRevealRange: function(range) { },
  127. /**
  128. * @param {number} lineNumber
  129. */
  130. highlightLine: function(lineNumber) { },
  131. clearLineHighlight: function() { },
  132. /**
  133. * @return {Array.<Element>}
  134. */
  135. elementsToRestoreScrollPositionsFor: function() { },
  136. /**
  137. * @param {WebInspector.TextEditor} textEditor
  138. */
  139. inheritScrollPositions: function(textEditor) { },
  140. beginUpdates: function() { },
  141. endUpdates: function() { },
  142. onResize: function() { },
  143. /**
  144. * @param {WebInspector.TextRange} range
  145. * @param {string} text
  146. * @return {WebInspector.TextRange}
  147. */
  148. editRange: function(range, text) { },
  149. /**
  150. * @param {number} lineNumber
  151. */
  152. scrollToLine: function(lineNumber) { },
  153. /**
  154. * @return {WebInspector.TextRange}
  155. */
  156. selection: function() { },
  157. /**
  158. * @return {WebInspector.TextRange?}
  159. */
  160. lastSelection: function() { },
  161. /**
  162. * @param {WebInspector.TextRange} textRange
  163. */
  164. setSelection: function(textRange) { },
  165. /**
  166. * @param {WebInspector.TextRange} range
  167. * @return {string}
  168. */
  169. copyRange: function(range) { },
  170. /**
  171. * @param {string} text
  172. */
  173. setText: function(text) { },
  174. /**
  175. * @return {string}
  176. */
  177. text: function() { },
  178. /**
  179. * @return {WebInspector.TextRange}
  180. */
  181. range: function() { },
  182. /**
  183. * @param {number} lineNumber
  184. * @return {string}
  185. */
  186. line: function(lineNumber) { },
  187. /**
  188. * @return {number}
  189. */
  190. get linesCount() { },
  191. /**
  192. * @param {number} line
  193. * @param {string} name
  194. * @param {Object?} value
  195. */
  196. setAttribute: function(line, name, value) { },
  197. /**
  198. * @param {number} line
  199. * @param {string} name
  200. * @return {Object|null} value
  201. */
  202. getAttribute: function(line, name) { },
  203. /**
  204. * @param {number} line
  205. * @param {string} name
  206. */
  207. removeAttribute: function(line, name) { },
  208. wasShown: function() { },
  209. willHide: function() { }
  210. }
  211. /**
  212. * @interface
  213. */
  214. WebInspector.TextEditorDelegate = function()
  215. {
  216. }
  217. WebInspector.TextEditorDelegate.prototype = {
  218. /**
  219. * @param {WebInspector.TextRange} oldRange
  220. * @param {WebInspector.TextRange} newRange
  221. */
  222. onTextChanged: function(oldRange, newRange) { },
  223. /**
  224. * @param {WebInspector.TextRange} textRange
  225. */
  226. selectionChanged: function(textRange) { },
  227. /**
  228. * @param {number} lineNumber
  229. */
  230. scrollChanged: function(lineNumber) { },
  231. /**
  232. * @param {WebInspector.ContextMenu} contextMenu
  233. * @param {number} lineNumber
  234. */
  235. populateLineGutterContextMenu: function(contextMenu, lineNumber) { },
  236. /**
  237. * @param {WebInspector.ContextMenu} contextMenu
  238. * @param {number} lineNumber
  239. */
  240. populateTextAreaContextMenu: function(contextMenu, lineNumber) { },
  241. /**
  242. * @param {string} hrefValue
  243. * @param {boolean} isExternal
  244. * @return {Element}
  245. */
  246. createLink: function(hrefValue, isExternal) { }
  247. }