本文整理汇总了TypeScript中vs/editor/browser/view/viewPart.PartFingerprints.write方法的典型用法代码示例。如果您正苦于以下问题:TypeScript PartFingerprints.write方法的具体用法?TypeScript PartFingerprints.write怎么用?TypeScript PartFingerprints.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/editor/browser/view/viewPart.PartFingerprints
的用法示例。
在下文中一共展示了PartFingerprints.write方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(context: ViewContext, viewDomNode: FastDomNode<HTMLElement>) {
super(context);
this._viewDomNode = viewDomNode;
this._widgets = {};
this.domNode = createFastDomNode(document.createElement('div'));
PartFingerprints.write(this.domNode, PartFingerprint.ContentWidgets);
this.domNode.setClassName('contentWidgets');
this.domNode.setPosition('absolute');
this.domNode.setTop(0);
this.overflowingContentWidgetsDomNode = createFastDomNode(document.createElement('div'));
PartFingerprints.write(this.overflowingContentWidgetsDomNode, PartFingerprint.OverflowingContentWidgets);
this.overflowingContentWidgetsDomNode.setClassName('overflowingContentWidgets');
}
示例2: constructor
constructor(context: ViewContext, viewDomNode: HTMLElement) {
super(context);
this._viewDomNode = viewDomNode;
this._widgets = {};
this._contentWidth = 0;
this._contentLeft = 0;
this._lineHeight = this._context.configuration.editor.lineHeight;
this._renderData = {};
this.domNode = document.createElement('div');
PartFingerprints.write(this.domNode, PartFingerprint.ContentWidgets);
this.domNode.className = ClassNames.CONTENT_WIDGETS;
this.domNode.style.position = 'absolute';
this.domNode.style.top = '0';
this.overflowingContentWidgetsDomNode = document.createElement('div');
PartFingerprints.write(this.overflowingContentWidgetsDomNode, PartFingerprint.OverflowingContentWidgets);
this.overflowingContentWidgetsDomNode.className = ClassNames.OVERFLOWING_CONTENT_WIDGETS;
}
示例3: constructor
constructor(context: ViewContext, viewDomNode: FastDomNode<HTMLElement>) {
super(context);
this._viewDomNode = viewDomNode;
this._widgets = {};
this._contentWidth = this._context.configuration.editor.layoutInfo.contentWidth;
this._contentLeft = this._context.configuration.editor.layoutInfo.contentLeft;
this._lineHeight = this._context.configuration.editor.lineHeight;
this._renderData = {};
this.domNode = createFastDomNode(document.createElement('div'));
PartFingerprints.write(this.domNode, PartFingerprint.ContentWidgets);
this.domNode.setClassName('contentWidgets');
this.domNode.setPosition('absolute');
this.domNode.setTop(0);
this.overflowingContentWidgetsDomNode = createFastDomNode(document.createElement('div'));
PartFingerprints.write(this.overflowingContentWidgetsDomNode, PartFingerprint.OverflowingContentWidgets);
this.overflowingContentWidgetsDomNode.setClassName('overflowingContentWidgets');
}
示例4: constructor
constructor(context: ViewContext) {
super(context);
this._widgets = {};
this._verticalScrollbarWidth = 0;
this._horizontalScrollbarHeight = 0;
this._editorHeight = 0;
this._editorWidth = 0;
this.domNode = document.createElement('div');
PartFingerprints.write(this.domNode, PartFingerprint.OverlayWidgets);
this.domNode.className = ClassNames.OVERLAY_WIDGETS;
}
示例5: constructor
constructor(context: ViewContext) {
super(context);
this._widgets = {};
this._verticalScrollbarWidth = this._context.configuration.editor.layoutInfo.verticalScrollbarWidth;
this._minimapWidth = this._context.configuration.editor.layoutInfo.minimapWidth;
this._horizontalScrollbarHeight = this._context.configuration.editor.layoutInfo.horizontalScrollbarHeight;
this._editorHeight = this._context.configuration.editor.layoutInfo.height;
this._editorWidth = this._context.configuration.editor.layoutInfo.width;
this._domNode = createFastDomNode(document.createElement('div'));
PartFingerprints.write(this._domNode.domNode, PartFingerprint.OverlayWidgets);
this._domNode.setClassName(ClassNames.OVERLAY_WIDGETS);
}
示例6: createTextArea
private createTextArea(): void {
// Text Area (The focus will always be in the textarea when the cursor is blinking)
this.textArea = createFastDomNode(document.createElement('textarea'));
PartFingerprints.write(this.textArea.domNode, PartFingerprint.TextArea);
this.textArea.setClassName(editorBrowser.ClassNames.TEXTAREA);
this.textArea.setAttribute('wrap', 'off');
this.textArea.setAttribute('autocorrect', 'off');
this.textArea.setAttribute('autocapitalize', 'off');
this.textArea.setAttribute('spellcheck', 'false');
this.textArea.setAttribute('aria-label', this._context.configuration.editor.viewInfo.ariaLabel);
this.textArea.setAttribute('role', 'textbox');
this.textArea.setAttribute('aria-multiline', 'true');
this.textArea.setAttribute('aria-haspopup', 'false');
this.textArea.setAttribute('aria-autocomplete', 'both');
this.textArea.setTop(0);
this.textArea.setLeft(0);
this.listenersToDispose.push(dom.addDisposableListener(this.textArea.domNode, 'focus', () => this._setHasFocus(true)));
this.listenersToDispose.push(dom.addDisposableListener(this.textArea.domNode, 'blur', () => this._setHasFocus(false)));
// On top of the text area, we position a dom node to cover it up
// (there have been reports of tiny blinking cursors)
// (in WebKit the textarea is 1px by 1px because it cannot handle input to a 0x0 textarea)
this.textAreaCover = createFastDomNode(document.createElement('div'));
if (this._context.configuration.editor.viewInfo.glyphMargin) {
this.textAreaCover.setClassName('monaco-editor-background ' + editorBrowser.ClassNames.GLYPH_MARGIN + ' ' + editorBrowser.ClassNames.TEXTAREA_COVER);
} else {
if (this._context.configuration.editor.viewInfo.renderLineNumbers) {
this.textAreaCover.setClassName('monaco-editor-background ' + editorBrowser.ClassNames.LINE_NUMBERS + ' ' + editorBrowser.ClassNames.TEXTAREA_COVER);
} else {
this.textAreaCover.setClassName('monaco-editor-background ' + editorBrowser.ClassNames.TEXTAREA_COVER);
}
}
this.textAreaCover.setPosition('absolute');
this.textAreaCover.setWidth(1);
this.textAreaCover.setHeight(1);
this.textAreaCover.setTop(0);
this.textAreaCover.setLeft(0);
}
示例7: createViewParts
private createViewParts(): void {
// These two dom nodes must be constructed up front, since references are needed in the layout provider (scrolling & co.)
this.linesContent = createFastDomNode(document.createElement('div'));
this.linesContent.setClassName('lines-content' + ' monaco-editor-background');
this.linesContent.setPosition('absolute');
this.domNode = createFastDomNode(document.createElement('div'));
this.domNode.setClassName(this.getEditorClassName());
this.overflowGuardContainer = createFastDomNode(document.createElement('div'));
PartFingerprints.write(this.overflowGuardContainer, PartFingerprint.OverflowGuard);
this.overflowGuardContainer.setClassName('overflow-guard');
this._scrollbar = new EditorScrollbar(this._context, this.linesContent, this.domNode, this.overflowGuardContainer);
this.viewParts.push(this._scrollbar);
// View Lines
this.viewLines = new ViewLines(this._context, this.linesContent);
// View Zones
this.viewZones = new ViewZones(this._context);
this.viewParts.push(this.viewZones);
// Decorations overview ruler
let decorationsOverviewRuler = new DecorationsOverviewRuler(this._context);
this.viewParts.push(decorationsOverviewRuler);
let scrollDecoration = new ScrollDecorationViewPart(this._context);
this.viewParts.push(scrollDecoration);
let contentViewOverlays = new ContentViewOverlays(this._context);
this.viewParts.push(contentViewOverlays);
contentViewOverlays.addDynamicOverlay(new CurrentLineHighlightOverlay(this._context));
contentViewOverlays.addDynamicOverlay(new SelectionsOverlay(this._context));
contentViewOverlays.addDynamicOverlay(new IndentGuidesOverlay(this._context));
contentViewOverlays.addDynamicOverlay(new DecorationsOverlay(this._context));
let marginViewOverlays = new MarginViewOverlays(this._context);
this.viewParts.push(marginViewOverlays);
marginViewOverlays.addDynamicOverlay(new CurrentLineMarginHighlightOverlay(this._context));
marginViewOverlays.addDynamicOverlay(new GlyphMarginOverlay(this._context));
marginViewOverlays.addDynamicOverlay(new MarginViewLineDecorationsOverlay(this._context));
marginViewOverlays.addDynamicOverlay(new LinesDecorationsOverlay(this._context));
marginViewOverlays.addDynamicOverlay(new LineNumbersOverlay(this._context));
let margin = new Margin(this._context);
margin.getDomNode().appendChild(this.viewZones.marginDomNode);
margin.getDomNode().appendChild(marginViewOverlays.getDomNode());
this.viewParts.push(margin);
// Content widgets
this.contentWidgets = new ViewContentWidgets(this._context, this.domNode);
this.viewParts.push(this.contentWidgets);
this.viewCursors = new ViewCursors(this._context);
this.viewParts.push(this.viewCursors);
// Overlay widgets
this.overlayWidgets = new ViewOverlayWidgets(this._context);
this.viewParts.push(this.overlayWidgets);
let rulers = new Rulers(this._context);
this.viewParts.push(rulers);
let minimap = new Minimap(this._context);
this.viewParts.push(minimap);
// -------------- Wire dom nodes up
if (decorationsOverviewRuler) {
let overviewRulerData = this._scrollbar.getOverviewRulerLayoutInfo();
overviewRulerData.parent.insertBefore(decorationsOverviewRuler.getDomNode(), overviewRulerData.insertBefore);
}
this.linesContent.appendChild(contentViewOverlays.getDomNode());
this.linesContent.appendChild(rulers.domNode);
this.linesContent.appendChild(this.viewZones.domNode);
this.linesContent.appendChild(this.viewLines.getDomNode());
this.linesContent.appendChild(this.contentWidgets.domNode);
this.linesContent.appendChild(this.viewCursors.getDomNode());
this.overflowGuardContainer.appendChild(margin.getDomNode());
this.overflowGuardContainer.appendChild(this._scrollbar.getDomNode());
this.overflowGuardContainer.appendChild(scrollDecoration.getDomNode());
this.overflowGuardContainer.appendChild(this._textAreaHandler.textArea);
this.overflowGuardContainer.appendChild(this._textAreaHandler.textAreaCover);
this.overflowGuardContainer.appendChild(this.overlayWidgets.getDomNode());
this.overflowGuardContainer.appendChild(minimap.getDomNode());
this.domNode.appendChild(this.overflowGuardContainer);
this.domNode.appendChild(this.contentWidgets.overflowingContentWidgetsDomNode);
}
示例8: constructor
constructor(
context: ViewContext,
scrollable: Scrollable,
linesContent: FastDomNode<HTMLElement>,
viewDomNode: FastDomNode<HTMLElement>,
overflowGuardDomNode: FastDomNode<HTMLElement>
) {
super(context);
this.toDispose = [];
this.scrollable = scrollable;
const viewInfo = this._context.configuration.editor.viewInfo;
const configScrollbarOpts = viewInfo.scrollbar;
let scrollbarOptions: ScrollableElementCreationOptions = {
canUseTranslate3d: viewInfo.canUseTranslate3d,
listenOnDomNode: viewDomNode.domNode,
className: ClassNames.SCROLLABLE_ELEMENT + ' ' + viewInfo.theme,
useShadows: false,
lazyRender: true,
vertical: configScrollbarOpts.vertical,
horizontal: configScrollbarOpts.horizontal,
verticalHasArrows: configScrollbarOpts.verticalHasArrows,
horizontalHasArrows: configScrollbarOpts.horizontalHasArrows,
verticalScrollbarSize: configScrollbarOpts.verticalScrollbarSize,
verticalSliderSize: configScrollbarOpts.verticalSliderSize,
horizontalScrollbarSize: configScrollbarOpts.horizontalScrollbarSize,
horizontalSliderSize: configScrollbarOpts.horizontalSliderSize,
handleMouseWheel: configScrollbarOpts.handleMouseWheel,
arrowSize: configScrollbarOpts.arrowSize,
mouseWheelScrollSensitivity: configScrollbarOpts.mouseWheelScrollSensitivity,
};
this.scrollbar = new ScrollableElement(linesContent.domNode, scrollbarOptions, this.scrollable);
PartFingerprints.write(this.scrollbar.getDomNode(), PartFingerprint.ScrollableElement);
this.toDispose.push(this.scrollbar);
this.scrollbarDomNode = createFastDomNode(this.scrollbar.getDomNode());
this.scrollbarDomNode.setPosition('absolute');
this._setLayout();
// When having a zone widget that calls .focus() on one of its dom elements,
// the browser will try desperately to reveal that dom node, unexpectedly
// changing the .scrollTop of this.linesContent
let onBrowserDesperateReveal = (domNode: HTMLElement, lookAtScrollTop: boolean, lookAtScrollLeft: boolean) => {
const scrollState = this.scrollable.getState();
let newScrollPosition: INewScrollPosition = {};
if (lookAtScrollTop) {
let deltaTop = domNode.scrollTop;
if (deltaTop) {
newScrollPosition.scrollTop = scrollState.scrollTop + deltaTop;
domNode.scrollTop = 0;
}
}
if (lookAtScrollLeft) {
let deltaLeft = domNode.scrollLeft;
if (deltaLeft) {
newScrollPosition.scrollLeft = scrollState.scrollLeft + deltaLeft;
domNode.scrollLeft = 0;
}
}
this.scrollable.updateState(newScrollPosition);
};
// I've seen this happen both on the view dom node & on the lines content dom node.
this.toDispose.push(dom.addDisposableListener(viewDomNode.domNode, 'scroll', (e: Event) => onBrowserDesperateReveal(viewDomNode.domNode, true, true)));
this.toDispose.push(dom.addDisposableListener(linesContent.domNode, 'scroll', (e: Event) => onBrowserDesperateReveal(linesContent.domNode, true, false)));
this.toDispose.push(dom.addDisposableListener(overflowGuardDomNode.domNode, 'scroll', (e: Event) => onBrowserDesperateReveal(overflowGuardDomNode.domNode, true, false)));
}
示例9: constructor
constructor(scrollable: Scrollable, configuration: IConfiguration, linesContent: HTMLElement, viewDomNode: HTMLElement, overflowGuardDomNode: HTMLElement) {
this.toDispose = [];
this.scrollable = scrollable;
this.configuration = configuration;
this.linesContent = linesContent;
let configScrollbarOpts = this.configuration.editor.viewInfo.scrollbar;
let scrollbarOptions: ScrollableElementCreationOptions = {
canUseTranslate3d: this.configuration.editor.viewInfo.canUseTranslate3d,
listenOnDomNode: viewDomNode,
vertical: configScrollbarOpts.vertical,
horizontal: configScrollbarOpts.horizontal,
className: ClassNames.SCROLLABLE_ELEMENT + ' ' + this.configuration.editor.viewInfo.theme,
useShadows: false,
lazyRender: true,
saveLastScrollTimeOnClassName: ClassNames.VIEW_LINE
};
addPropertyIfPresent(configScrollbarOpts, scrollbarOptions, 'verticalHasArrows');
addPropertyIfPresent(configScrollbarOpts, scrollbarOptions, 'horizontalHasArrows');
addPropertyIfPresent(configScrollbarOpts, scrollbarOptions, 'verticalScrollbarSize');
addPropertyIfPresent(configScrollbarOpts, scrollbarOptions, 'verticalSliderSize');
addPropertyIfPresent(configScrollbarOpts, scrollbarOptions, 'horizontalScrollbarSize');
addPropertyIfPresent(configScrollbarOpts, scrollbarOptions, 'horizontalSliderSize');
addPropertyIfPresent(configScrollbarOpts, scrollbarOptions, 'handleMouseWheel');
addPropertyIfPresent(configScrollbarOpts, scrollbarOptions, 'arrowSize');
addPropertyIfPresent(configScrollbarOpts, scrollbarOptions, 'mouseWheelScrollSensitivity');
this.scrollbar = new ScrollableElement(linesContent, scrollbarOptions, this.scrollable);
PartFingerprints.write(this.scrollbar.getDomNode(), PartFingerprint.ScrollableElement);
this.toDispose.push(this.scrollbar);
this.toDispose.push(this.configuration.onDidChange((e: IConfigurationChangedEvent) => {
this.scrollbar.updateClassName(ClassNames.SCROLLABLE_ELEMENT + ' ' + this.configuration.editor.viewInfo.theme);
if (e.viewInfo.scrollbar || e.viewInfo.canUseTranslate3d) {
let newOpts: ScrollableElementChangeOptions = {
canUseTranslate3d: this.configuration.editor.viewInfo.canUseTranslate3d,
handleMouseWheel: this.configuration.editor.viewInfo.scrollbar.handleMouseWheel,
mouseWheelScrollSensitivity: this.configuration.editor.viewInfo.scrollbar.mouseWheelScrollSensitivity
};
this.scrollbar.updateOptions(newOpts);
}
}));
// When having a zone widget that calls .focus() on one of its dom elements,
// the browser will try desperately to reveal that dom node, unexpectedly
// changing the .scrollTop of this.linesContent
let onBrowserDesperateReveal = (domNode: HTMLElement, lookAtScrollTop: boolean, lookAtScrollLeft: boolean) => {
const scrollState = this.scrollable.getState();
let newScrollPosition: INewScrollPosition = {};
if (lookAtScrollTop) {
let deltaTop = domNode.scrollTop;
if (deltaTop) {
newScrollPosition.scrollTop = scrollState.scrollTop + deltaTop;
domNode.scrollTop = 0;
}
}
if (lookAtScrollLeft) {
let deltaLeft = domNode.scrollLeft;
if (deltaLeft) {
newScrollPosition.scrollLeft = scrollState.scrollLeft + deltaLeft;
domNode.scrollLeft = 0;
}
}
this.scrollable.updateState(newScrollPosition);
};
// I've seen this happen both on the view dom node & on the lines content dom node.
this.toDispose.push(dom.addDisposableListener(viewDomNode, 'scroll', (e: Event) => onBrowserDesperateReveal(viewDomNode, true, true)));
this.toDispose.push(dom.addDisposableListener(linesContent, 'scroll', (e: Event) => onBrowserDesperateReveal(linesContent, true, false)));
this.toDispose.push(dom.addDisposableListener(overflowGuardDomNode, 'scroll', (e: Event) => onBrowserDesperateReveal(overflowGuardDomNode, true, false)));
}
示例10: constructor
constructor(
context: ViewContext,
linesContent: FastDomNode<HTMLElement>,
viewDomNode: FastDomNode<HTMLElement>,
overflowGuardDomNode: FastDomNode<HTMLElement>
) {
super(context);
const editor = this._context.configuration.editor;
const configScrollbarOpts = editor.viewInfo.scrollbar;
let scrollbarOptions: ScrollableElementCreationOptions = {
listenOnDomNode: viewDomNode.domNode,
className: 'editor-scrollable' + ' ' + getThemeTypeSelector(context.theme.type),
useShadows: false,
lazyRender: true,
vertical: configScrollbarOpts.vertical,
horizontal: configScrollbarOpts.horizontal,
verticalHasArrows: configScrollbarOpts.verticalHasArrows,
horizontalHasArrows: configScrollbarOpts.horizontalHasArrows,
verticalScrollbarSize: configScrollbarOpts.verticalScrollbarSize,
verticalSliderSize: configScrollbarOpts.verticalSliderSize,
horizontalScrollbarSize: configScrollbarOpts.horizontalScrollbarSize,
horizontalSliderSize: configScrollbarOpts.horizontalSliderSize,
handleMouseWheel: configScrollbarOpts.handleMouseWheel,
arrowSize: configScrollbarOpts.arrowSize,
mouseWheelScrollSensitivity: configScrollbarOpts.mouseWheelScrollSensitivity,
};
this.scrollbar = this._register(new SmoothScrollableElement(linesContent.domNode, scrollbarOptions, this._context.viewLayout.scrollable));
PartFingerprints.write(this.scrollbar.getDomNode(), PartFingerprint.ScrollableElement);
this.scrollbarDomNode = createFastDomNode(this.scrollbar.getDomNode());
this.scrollbarDomNode.setPosition('absolute');
this._setLayout();
// When having a zone widget that calls .focus() on one of its dom elements,
// the browser will try desperately to reveal that dom node, unexpectedly
// changing the .scrollTop of this.linesContent
let onBrowserDesperateReveal = (domNode: HTMLElement, lookAtScrollTop: boolean, lookAtScrollLeft: boolean) => {
let newScrollPosition: INewScrollPosition = {};
if (lookAtScrollTop) {
let deltaTop = domNode.scrollTop;
if (deltaTop) {
newScrollPosition.scrollTop = this._context.viewLayout.getCurrentScrollTop() + deltaTop;
domNode.scrollTop = 0;
}
}
if (lookAtScrollLeft) {
let deltaLeft = domNode.scrollLeft;
if (deltaLeft) {
newScrollPosition.scrollLeft = this._context.viewLayout.getCurrentScrollLeft() + deltaLeft;
domNode.scrollLeft = 0;
}
}
this._context.viewLayout.setScrollPositionNow(newScrollPosition);
};
// I've seen this happen both on the view dom node & on the lines content dom node.
this._register(dom.addDisposableListener(viewDomNode.domNode, 'scroll', (e: Event) => onBrowserDesperateReveal(viewDomNode.domNode, true, true)));
this._register(dom.addDisposableListener(linesContent.domNode, 'scroll', (e: Event) => onBrowserDesperateReveal(linesContent.domNode, true, false)));
this._register(dom.addDisposableListener(overflowGuardDomNode.domNode, 'scroll', (e: Event) => onBrowserDesperateReveal(overflowGuardDomNode.domNode, true, false)));
this._register(dom.addDisposableListener(this.scrollbarDomNode.domNode, 'scroll', (e: Event) => onBrowserDesperateReveal(this.scrollbarDomNode.domNode, true, false)));
}