File modules/editor/codemirror/src/display/Display.min.js
Last commit: Tue May 22 22:39:55 2018 +0200 Jan Dankert Fix für PHP 7.2: 'Object' darf nun nicht mehr als Klassennamen verwendet werden. AUCH NICHT IN EINEM NAMESPACE! WTF, wozu habe ich das in einen verfickten Namespace gepackt? Wozu soll der sonst da sein??? Amateure. Daher nun notgedrungen unbenannt in 'BaseObject'.
1 import { gecko, ie, ie_version, mobile, webkit } from "../util/browser.js" 2 import { elt, eltP } from "../util/dom.js" 3 import { scrollerGap } from "../util/misc.js" 4 5 // The display handles the DOM integration, both for input reading 6 // and content drawing. It holds references to DOM nodes and 7 // display-related state. 8 9 export function Display(place, doc, input) { 10 let d = this 11 this.input = input 12 13 // Covers bottom-right square when both scrollbars are present. 14 d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler") 15 d.scrollbarFiller.setAttribute("cm-not-content", "true") 16 // Covers bottom of gutter when coverGutterNextToScrollbar is on 17 // and h scrollbar is present. 18 d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler") 19 d.gutterFiller.setAttribute("cm-not-content", "true") 20 // Will contain the actual code, positioned to cover the viewport. 21 d.lineDiv = eltP("div", null, "CodeMirror-code") 22 // Elements are added to these to represent selection and cursors. 23 d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1") 24 d.cursorDiv = elt("div", null, "CodeMirror-cursors") 25 // A visibility: hidden element used to find the size of things. 26 d.measure = elt("div", null, "CodeMirror-measure") 27 // When lines outside of the viewport are measured, they are drawn in this. 28 d.lineMeasure = elt("div", null, "CodeMirror-measure") 29 // Wraps everything that needs to exist inside the vertically-padded coordinate system 30 d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv], 31 null, "position: relative; outline: none") 32 let lines = eltP("div", [d.lineSpace], "CodeMirror-lines") 33 // Moved around its parent to cover visible view. 34 d.mover = elt("div", [lines], null, "position: relative") 35 // Set to the height of the document, allowing scrolling. 36 d.sizer = elt("div", [d.mover], "CodeMirror-sizer") 37 d.sizerWidth = null 38 // Behavior of elts with overflow: auto and padding is 39 // inconsistent across browsers. This is used to ensure the 40 // scrollable area is big enough. 41 d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;") 42 // Will contain the gutters, if any. 43 d.gutters = elt("div", null, "CodeMirror-gutters") 44 d.lineGutter = null 45 // Actual scrollable element. 46 d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll") 47 d.scroller.setAttribute("tabIndex", "-1") 48 // The element in which the editor lives. 49 d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror") 50 51 // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported) 52 if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0 } 53 if (!webkit && !(gecko && mobile)) d.scroller.draggable = true 54 55 if (place) { 56 if (place.appendChild) place.appendChild(d.wrapper) 57 else place(d.wrapper) 58 } 59 60 // Current rendered range (may be bigger than the view window). 61 d.viewFrom = d.viewTo = doc.first 62 d.reportedViewFrom = d.reportedViewTo = doc.first 63 // Information about the rendered lines. 64 d.view = [] 65 d.renderedView = null 66 // Holds info about a single rendered line when it was rendered 67 // for measurement, while not in view. 68 d.externalMeasured = null 69 // Empty space (in pixels) above the view 70 d.viewOffset = 0 71 d.lastWrapHeight = d.lastWrapWidth = 0 72 d.updateLineNumbers = null 73 74 d.nativeBarWidth = d.barHeight = d.barWidth = 0 75 d.scrollbarsClipped = false 76 77 // Used to only resize the line number gutter when necessary (when 78 // the amount of lines crosses a boundary that makes its width change) 79 d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null 80 // Set to true when a non-horizontal-scrolling line widget is 81 // added. As an optimization, line widget aligning is skipped when 82 // this is false. 83 d.alignWidgets = false 84 85 d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null 86 87 // Tracks the maximum line length so that the horizontal scrollbar 88 // can be kept static when scrolling. 89 d.maxLine = null 90 d.maxLineLength = 0 91 d.maxLineChanged = false 92 93 // Used for measuring wheel scrolling granularity 94 d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null 95 96 // True when shift is held down. 97 d.shift = false 98 99 // Used to track whether anything happened since the context menu 100 // was opened. 101 d.selForContextMenu = null 102 103 d.activeTouch = null 104 105 input.init(d) 106 }
Downloadmodules/editor/codemirror/src/display/Display.min.js
History Tue, 22 May 2018 22:39:55 +0200 Jan Dankert Fix für PHP 7.2: 'Object' darf nun nicht mehr als Klassennamen verwendet werden. AUCH NICHT IN EINEM NAMESPACE! WTF, wozu habe ich das in einen verfickten Namespace gepackt? Wozu soll der sonst da sein??? Amateure. Daher nun notgedrungen unbenannt in 'BaseObject'.