TextEditor.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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. /** @typedef {{lineNumber: number, event: Event}} */
  39. WebInspector.TextEditor.GutterClickEventData;
  40. WebInspector.TextEditor.prototype = {
  41. undo: function() { },
  42. redo: function() { },
  43. /**
  44. * @return {boolean}
  45. */
  46. isClean: function() { },
  47. markClean: function() { },
  48. /**
  49. * @return {string}
  50. */
  51. indent: function() { },
  52. /*
  53. * @param {number} lineNumber
  54. * @param {number} column
  55. * @return {?{x: number, y: number, height: number}}
  56. */
  57. cursorPositionToCoordinates: function(lineNumber, column) { return null; },
  58. /**
  59. * @param {number} x
  60. * @param {number} y
  61. * @return {?WebInspector.TextRange}
  62. */
  63. coordinatesToCursorPosition: function(x, y) { return null; },
  64. /**
  65. * @param {number} lineNumber
  66. * @param {number} column
  67. * @return {?{startColumn: number, endColumn: number, type: string}}
  68. */
  69. tokenAtTextPosition: function(lineNumber, column) { return null; },
  70. /**
  71. * @param {string} mimeType
  72. */
  73. setMimeType: function(mimeType) { },
  74. /**
  75. * @param {boolean} readOnly
  76. */
  77. setReadOnly: function(readOnly) { },
  78. /**
  79. * @return {boolean}
  80. */
  81. readOnly: function() { },
  82. /**
  83. * @return {Element}
  84. */
  85. defaultFocusedElement: function() { },
  86. /**
  87. * @param {string} regex
  88. * @param {string} cssClass
  89. * @return {Object}
  90. */
  91. highlightRegex: function(regex, cssClass) { },
  92. /**
  93. * @param {WebInspector.TextRange} range
  94. * @param {string} cssClass
  95. * @return {Object}
  96. */
  97. highlightRange: function(range, cssClass) { },
  98. /**
  99. * @param {Object} highlightDescriptor
  100. */
  101. removeHighlight: function(highlightDescriptor) { },
  102. /**
  103. * @param {number} lineNumber
  104. */
  105. revealLine: function(lineNumber) { },
  106. /**
  107. * @param {number} lineNumber
  108. * @param {boolean} disabled
  109. * @param {boolean} conditional
  110. */
  111. addBreakpoint: function(lineNumber, disabled, conditional) { },
  112. /**
  113. * @param {number} lineNumber
  114. */
  115. removeBreakpoint: function(lineNumber) { },
  116. /**
  117. * @param {number} lineNumber
  118. */
  119. setExecutionLine: function(lineNumber) { },
  120. clearExecutionLine: function() { },
  121. /**
  122. * @param {number} lineNumber
  123. * @param {Element} element
  124. */
  125. addDecoration: function(lineNumber, element) { },
  126. /**
  127. * @param {number} lineNumber
  128. * @param {Element} element
  129. */
  130. removeDecoration: function(lineNumber, element) { },
  131. /**
  132. * @param {!RegExp} regex
  133. * @param {WebInspector.TextRange} range
  134. */
  135. highlightSearchResults: function(regex, range) { },
  136. /**
  137. * @param {number} lineNumber
  138. * @param {number=} columnNumber
  139. */
  140. highlightPosition: function(lineNumber, columnNumber) { },
  141. clearPositionHighlight: function() { },
  142. /**
  143. * @return {Array.<Element>}
  144. */
  145. elementsToRestoreScrollPositionsFor: function() { },
  146. /**
  147. * @param {WebInspector.TextEditor} textEditor
  148. */
  149. inheritScrollPositions: function(textEditor) { },
  150. beginUpdates: function() { },
  151. endUpdates: function() { },
  152. onResize: function() { },
  153. /**
  154. * @param {WebInspector.TextRange} range
  155. * @param {string} text
  156. * @return {WebInspector.TextRange}
  157. */
  158. editRange: function(range, text) { },
  159. /**
  160. * @param {number} lineNumber
  161. */
  162. scrollToLine: function(lineNumber) { },
  163. /**
  164. * @return {number}
  165. */
  166. firstVisibleLine: function() { },
  167. /**
  168. * @return {number}
  169. */
  170. lastVisibleLine: function() { },
  171. /**
  172. * @return {WebInspector.TextRange}
  173. */
  174. selection: function() { },
  175. /**
  176. * @return {WebInspector.TextRange?}
  177. */
  178. lastSelection: function() { },
  179. /**
  180. * @param {WebInspector.TextRange} textRange
  181. */
  182. setSelection: function(textRange) { },
  183. /**
  184. * @param {WebInspector.TextRange} range
  185. * @return {string}
  186. */
  187. copyRange: function(range) { },
  188. /**
  189. * @param {string} text
  190. */
  191. setText: function(text) { },
  192. /**
  193. * @return {string}
  194. */
  195. text: function() { },
  196. /**
  197. * @return {WebInspector.TextRange}
  198. */
  199. range: function() { },
  200. /**
  201. * @param {number} lineNumber
  202. * @return {string}
  203. */
  204. line: function(lineNumber) { },
  205. /**
  206. * @return {number}
  207. */
  208. get linesCount() { },
  209. /**
  210. * @param {number} line
  211. * @param {string} name
  212. * @param {Object?} value
  213. */
  214. setAttribute: function(line, name, value) { },
  215. /**
  216. * @param {number} line
  217. * @param {string} name
  218. * @return {Object|null} value
  219. */
  220. getAttribute: function(line, name) { },
  221. /**
  222. * @param {number} line
  223. * @param {string} name
  224. */
  225. removeAttribute: function(line, name) { },
  226. wasShown: function() { },
  227. willHide: function() { },
  228. /**
  229. * @param {WebInspector.CompletionDictionary} dictionary
  230. */
  231. setCompletionDictionary: function(dictionary) { },
  232. }
  233. /**
  234. * @interface
  235. */
  236. WebInspector.TextEditorDelegate = function()
  237. {
  238. }
  239. WebInspector.TextEditorDelegate.prototype = {
  240. /**
  241. * @param {WebInspector.TextRange} oldRange
  242. * @param {WebInspector.TextRange} newRange
  243. */
  244. onTextChanged: function(oldRange, newRange) { },
  245. /**
  246. * @param {WebInspector.TextRange} textRange
  247. */
  248. selectionChanged: function(textRange) { },
  249. /**
  250. * @param {number} lineNumber
  251. */
  252. scrollChanged: function(lineNumber) { },
  253. editorFocused: function() { },
  254. /**
  255. * @param {WebInspector.ContextMenu} contextMenu
  256. * @param {number} lineNumber
  257. */
  258. populateLineGutterContextMenu: function(contextMenu, lineNumber) { },
  259. /**
  260. * @param {WebInspector.ContextMenu} contextMenu
  261. * @param {number} lineNumber
  262. */
  263. populateTextAreaContextMenu: function(contextMenu, lineNumber) { },
  264. /**
  265. * @param {string} hrefValue
  266. * @param {boolean} isExternal
  267. * @return {Element}
  268. */
  269. createLink: function(hrefValue, isExternal) { }
  270. }