2475
this.cursorStops = options.cursorStops || null;
2476
}
2478
>
2479
>
export class ModelDecorationOptions implements model.IModelDecorationOptions {
2480
>
2481
>
public static EMPTY: ModelDecorationOptions;
2482
>
2483
>
public static register(options: model.IModelDecorationOptions): ModelDecorationOptions {
2484
>
return new ModelDecorationOptions(options);
2485
>
}
2486
>
2487
>
public static createDynamic(options: model.IModelDecorationOptions): ModelDecorationOptions {
2488
return new ModelDecorationOptions(options);
2489
}
2491
>
readonly blockClassName: string | null;
2492
>
readonly blockIsAfterEnd: boolean | null;
2493
>
readonly blockDoesNotCollapse?: boolean | null;
2494
>
readonly blockPadding: [top: number, right: number, bottom: number, left: number] | null;
2495
>
readonly stickiness: model.TrackedRangeStickiness;
2496
>
readonly zIndex: number;
2497
>
readonly className: string | null;
2498
>
readonly shouldFillLineOnLineBreak: boolean | null;
2499
>
readonly hoverMessage: IMarkdownString | IMarkdownString[] | null;
2500
>
readonly glyphMarginHoverMessage: IMarkdownString | IMarkdownString[] | null;
2501
>
readonly isWholeLine: boolean;
2502
>
readonly lineHeight: number | null;
2503
>
readonly fontSize: string | null;
2504
>
readonly showIfCollapsed: boolean;
2505
>
readonly collapseOnReplaceEdit: boolean;
2506
>
readonly overviewRuler: ModelDecorationOverviewRulerOptions | null;
2507
>
readonly minimap: ModelDecorationMinimapOptions | null;
2508
>
readonly glyphMargin?: model.IModelDecorationGlyphMarginOptions | null | undefined;
2509
>
readonly glyphMarginClassName: string | null;
2510
>
readonly linesDecorationsClassName: string | null;
2511
>
readonly lineNumberClassName: string | null;
2512
>
readonly lineNumberHoverMessage: IMarkdownString | IMarkdownString[] | null;
2513
>
readonly linesDecorationsTooltip: string | null;
2514
>
readonly firstLineDecorationClassName: string | null;
2515
>
readonly marginClassName: string | null;
2516
>
readonly inlineClassName: string | null;
2517
>
readonly inlineClassNameAffectsLetterSpacing: boolean;
2518
>
readonly beforeContentClassName: string | null;
2519
>
readonly afterContentClassName: string | null;
2520
>
readonly after: ModelDecorationInjectedTextOptions | null;
2521
>
readonly before: ModelDecorationInjectedTextOptions | null;
2522
>
readonly hideInCommentTokens: boolean | null;
2523
>
readonly hideInStringTokens: boolean | null;
2524
>
readonly affectsFont: boolean | null;
2525
>
readonly textDirection?: model.TextDirection | null | undefined;
2526
>
2527
>
private constructor(options: model.IModelDecorationOptions) {
2528
>
this.description = options.description;
2529
>
this.blockClassName = options.blockClassName ? cleanClassName(options.blockClassName) : null;
2530
>
this.blockDoesNotCollapse = options.blockDoesNotCollapse ?? null;
2531
>
this.blockIsAfterEnd = options.blockIsAfterEnd ?? null;
2532
>
this.blockPadding = options.blockPadding ?? null;
2533
>
this.stickiness = options.stickiness || model.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges;
2534
>
this.zIndex = options.zIndex || 0;
2535
>
this.className = options.className ? cleanClassName(options.className) : null;
2536
>
this.shouldFillLineOnLineBreak = options.shouldFillLineOnLineBreak ?? null;
2537
>
this.hoverMessage = options.hoverMessage || null;
2538
>
this.glyphMarginHoverMessage = options.glyphMarginHoverMessage || null;
2539
>
this.lineNumberHoverMessage = options.lineNumberHoverMessage || null;
2540
>
this.isWholeLine = options.isWholeLine || false;
2541
>
this.lineHeight = options.lineHeight ? Math.min(options.lineHeight, LINE_HEIGHT_CEILING) : null;
2542
>
this.fontSize = options.fontSize || null;
2543
>
this.affectsFont = !!options.fontSize || !!options.fontFamily || !!options.fontWeight || !!options.fontStyle;
2544
>
this.showIfCollapsed = options.showIfCollapsed || false;
2545
>
this.collapseOnReplaceEdit = options.collapseOnReplaceEdit || false;
2546
>
this.overviewRuler = options.overviewRuler ? new ModelDecorationOverviewRulerOptions(options.overviewRuler) : null;
2547
>
this.minimap = options.minimap ? new ModelDecorationMinimapOptions(options.minimap) : null;
2548
>
this.glyphMargin = options.glyphMarginClassName ? new ModelDecorationGlyphMarginOptions(options.glyphMargin) : null;
2549
>
this.glyphMarginClassName = options.glyphMarginClassName ? cleanClassName(options.glyphMarginClassName) : null;
2550
>
this.linesDecorationsClassName = options.linesDecorationsClassName ? cleanClassName(options.linesDecorationsClassName) : null;
2551
>
this.lineNumberClassName = options.lineNumberClassName ? cleanClassName(options.lineNumberClassName) : null;
2552
>
this.linesDecorationsTooltip = options.linesDecorationsTooltip ? strings.htmlAttributeEncodeValue(options.linesDecorationsTooltip) : null;
2553
>
this.firstLineDecorationClassName = options.firstLineDecorationClassName ? cleanClassName(options.firstLineDecorationClassName) : null;
2554
>
this.marginClassName = options.marginClassName ? cleanClassName(options.marginClassName) : null;
2555
>
this.inlineClassName = options.inlineClassName ? cleanClassName(options.inlineClassName) : null;
2556
>
this.inlineClassNameAffectsLetterSpacing = options.inlineClassNameAffectsLetterSpacing || false;
2557
>
this.beforeContentClassName = options.beforeContentClassName ? cleanClassName(options.beforeContentClassName) : null;
2558
>
this.afterContentClassName = options.afterContentClassName ? cleanClassName(options.afterContentClassName) : null;
2559
>
this.after = options.after ? ModelDecorationInjectedTextOptions.from(options.after) : null;
2560
>
this.before = options.before ? ModelDecorationInjectedTextOptions.from(options.before) : null;
2561
>
this.hideInCommentTokens = options.hideInCommentTokens ?? false;
2562
>
this.hideInStringTokens = options.hideInStringTokens ?? false;
2563
>
this.textDirection = options.textDirection ?? null;
2564
>
}
2565
>
}
2566
>
ModelDecorationOptions.EMPTY = ModelDecorationOptions.register({ description: 'empty' });
2567
>
2568
>
/**
2569
>
* The order carefully matches the values of the enum.
2570
>
*/
2571
>
const TRACKED_RANGE_OPTIONS = [
2572
>
ModelDecorationOptions.register({ description: 'tracked-range-always-grows-when-typing-at-edges', stickiness: model.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges }),
2573
>
ModelDecorationOptions.register({ description: 'tracked-range-never-grows-when-typing-at-edges', stickiness: model.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges }),
2574
>
ModelDecorationOptions.register({ description: 'tracked-range-grows-only-when-typing-before', stickiness: model.TrackedRangeStickiness.GrowsOnlyWhenTypingBefore }),
2575
>
ModelDecorationOptions.register({ description: 'tracked-range-grows-only-when-typing-after', stickiness: model.TrackedRangeStickiness.GrowsOnlyWhenTypingAfter }),
2576
>
];
2577
>
2578
function _normalizeOptions(options: model.IModelDecorationOptions): ModelDecorationOptions {
2579
if (options instanceof ModelDecorationOptions) {