Skip to content

Commit

Permalink
Merge pull request #617 from MauroDataMapper/feature/gh-453
Browse files Browse the repository at this point in the history
gh-453 Remove HTML editor fullscreen option
  • Loading branch information
pjmonks authored Aug 1, 2022
2 parents b8b1516 + 632d4e1 commit b90b4d7
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions src/app/utility/html-editor/html-editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export enum HtmlButtonMode {
templateUrl: './html-editor.component.html'
})
export class HtmlEditorComponent implements OnInit {

/* Inputs for manual properties */
@Input() inEditMode: boolean;
@Input() description: string;
Expand All @@ -73,7 +72,8 @@ export class HtmlEditorComponent implements OnInit {
private elementDialogService: ElementSelectorDialogueService,
private messageService: MessageService,
private elementTypesService: ElementTypesService,
private linkCreator: LinkCreatorService) { }
private linkCreator: LinkCreatorService
) {}

ngOnInit(): void {
const standardButtons = [
Expand Down Expand Up @@ -111,11 +111,11 @@ export class HtmlEditorComponent implements OnInit {
'redo',
'|',
'hr',
'copyformat',
'fullsize',
'copyformat'
];

const buttons = this.buttonMode === HtmlButtonMode.Basic ? basicButtons : standardButtons;
const buttons =
this.buttonMode === HtmlButtonMode.Basic ? basicButtons : standardButtons;

this.editorConfig = {
buttons,
Expand All @@ -139,22 +139,30 @@ export class HtmlEditorComponent implements OnInit {

const focusNode = editor.selection.sel.focusNode;

component.elementSelectorSubscription = component.messageService.elementSelector.subscribe(element => {
if (!element) {
return;
component.elementSelectorSubscription = component.messageService.elementSelector.subscribe(
(element) => {
if (!element) {
return;
}

component.elementTypesService
.getNamedLinkIdentifier(element)
.subscribe((namedLink) => {
const href = component.linkCreator.createLink(
namedLink,
null,
null
);
const html = editor.create.fromHTML(
`<a href='${href}' title='${element.label}'>${element.label}</a>`
);

editor.selection.setCursorIn(focusNode);
editor.selection.insertHTML(html);
});
}

component.elementTypesService.getNamedLinkIdentifier(element)
.subscribe(namedLink => {
const href = component.linkCreator.createLink(namedLink, null, null);
const html = editor.create.fromHTML(`<a href='${href}' title='${element.label}'>${element.label}</a>`);

editor.selection.setCursorIn(focusNode);
editor.selection.insertHTML(html);
});
});
);

component.elementDialogService.open([], []);
}

}

0 comments on commit b90b4d7

Please sign in to comment.