Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created December 21, 2020 12:21
Show Gist options
  • Save bjoerntx/f320ca4467f0ebe7a37dda0530224154 to your computer and use it in GitHub Desktop.
Save bjoerntx/f320ca4467f0ebe7a37dda0530224154 to your computer and use it in GitHub Desktop.
import { Component, HostListener } from '@angular/core';
declare const TXTextControl: any;
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'my-ds-editor-app';
@HostListener('document:dsDocumentEditorLoaded')
onDsDocumentEditorLoaded() {
console.log('The TXTextControl object exists from now on.');
TXTextControl.addEventListener("textControlLoaded", function() {
var sel = TXTextControl.selection;
sel.setText("Welcome to DS Server", function() {
sel.setStart(11);
sel.setLength(9);
sel.setBold(true);
sel.setFontSize(30);
});
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment