This commit is contained in:
Chris Chen 2025-11-02 09:13:42 -08:00
parent cd9021d9c0
commit 70aa8adbba
10 changed files with 76 additions and 86 deletions

View File

@ -95,7 +95,7 @@ export class PrayerComponent extends MyAppBase {
// message += "\n======= 備註 =======" + "\n" + comment;
// }
// message += "\n請使用方舟晚宴系統新增菜單唷!" + "\n" + "https://happiness.tours/CellGroup/dinner?openExternalBrowser=1"
// message += "\n請使用方舟晚宴系統新增菜單唷!" + "\n" + "https://golife.love/CellGroup/dinner?openExternalBrowser=1"
// this.lineService.pushLineMessage(message);
});
}

View File

@ -30,7 +30,7 @@ const teamSize: number[][] = [
const fourthQuestNeed2Failed = 7;
const SIGNAL_R_URL = (id: string = null) => { return `${environment.signalRUrl}/${id}Hub` }
//const SIGNAL_R_URL = (id: string = null) => { return `http://localhost:12071/hub` }
//const SIGNAL_R_URL = (id: string = null) => { return `http://happiness.tours:8088/${id}hub` }
//const SIGNAL_R_URL = (id: string = null) => { return `http://golife.love:8088/${id}hub` }
@Component({
selector: 'ngx-avalon',

View File

@ -26,5 +26,5 @@
<ng-template #WaitingMessage>
<h1>等待遊戲開始中...</h1>
<qr-code *ngIf="isHost" [size]="qrCodeWidth" [value]="'http://happiness.tours/games/avalon'"></qr-code>
<qr-code *ngIf="isHost" [size]="qrCodeWidth" [value]="'http://golife.love/games/avalon'"></qr-code>
</ng-template>

View File

@ -10,10 +10,12 @@
</nb-accordion-item-body>
</nb-accordion-item>
</nb-accordion>
</div> -->
</div>
<div class="col-12">
<md2-html-editor></md2-html-editor>
</div>
-->
<div class="col-12 col-md-5">
<nb-card>

View File

@ -1 +1 @@
<editor [init]="htmlEditorSetting"></editor>
<!-- <editor [init]="htmlEditorSetting"></editor> -->

View File

@ -1,109 +1,97 @@
import { Component, ElementRef, EventEmitter, Input, Output, Renderer2 } from '@angular/core';
import { Component, ElementRef, EventEmitter, Inject, Input, NgZone, Output, PLATFORM_ID, Renderer2 } from '@angular/core';
import { ControlValueAccessor, Validator, AbstractControl, ValidationErrors } from '@angular/forms';
import { Editor, RawEditorOptions } from 'tinymce';
import { MsgBoxService } from '../../../services/msg-box.service';
import { DropDownOption } from '../../../entity/dropDownOption';
import { MD2Icon } from '../massive-darkness2.model';
import { first } from 'rxjs/operators';
import { HtmlEditorSettings } from '../../../ui/html-editor/html-editor.model';
import { EditorComponent } from '@tinymce/tinymce-angular';
import { Editor } from 'tinymce';
@Component({
selector: 'md2-html-editor',
templateUrl: './md2-html-editor.component.html',
styleUrl: './md2-html-editor.component.scss'
})
export class MD2HtmlEditorComponent implements ControlValueAccessor, Validator {
private _lastBlurValue: string;
readonly: boolean = false;
isRequired: boolean = false;
@Input() id? = '';
@Input() name = '';
@Input() data: string;
@Output() focus = new EventEmitter();
@Output() blur = new EventEmitter<string>();
@Input('readonly')
public set input_readonly(value) {
this.readonly = typeof value !== 'undefined' && value !== false;
}
@Input('isRequired')
public set input_isRequired(value) {
this.isRequired = typeof value !== 'undefined' && value !== false;
}
export class MD2HtmlEditorComponent extends EditorComponent implements ControlValueAccessor {
htmlEditorSetting: HtmlEditorSettings = {};
constructor(
private msgBoxService: MsgBoxService,
private elementRef: ElementRef,
private renderer: Renderer2) {
elementRef: ElementRef, ngZone: NgZone, @Inject(PLATFORM_ID) platformId: Object) {
super(elementRef, ngZone, platformId);
// this.elementRef is private. Need a duplicate
this._elementRef2 = elementRef;
this.htmlEditorSetting.base_url = '/tinymce';
this.htmlEditorSetting.suffix = '.min';
this.htmlEditorSetting['parentComponent'] = this;
this.htmlEditorSetting.plugins = 'lists link image table code';
this.htmlEditorSetting.toolbar2 = 'customInsertButton'
this.htmlEditorSetting.setup = this.htmlEditorSetup;
this.htmlEditorSetting.plugins = [
'noneditable', 'lists', 'link', 'image', 'table', 'code'];
this.htmlEditorSetting.toolbar = ['undo redo | blocks | bold italic | alignleft aligncentre alignright alignjustify | indent outdent | bullist numlist | code customInsertButton'];
this.htmlEditorSetting.content_style = '.MD2Icon{font-family: "Massive Darkness 2", sans-serif !important; font-size: 40px; margin-left:5px} body{font-size: 30px; }';
this.htmlEditorSetting.noneditable_noneditable_class = 'MD2Icon';
//this.htmlEditorSetting.o = this.htmlEditorSetup;
this.htmlEditorSetting.setup = (editor) => this.htmlEditorSetup(editor)
}
htmlEditorSetting: RawEditorOptions = {};
htmlEditorSetup(editor: Editor) {
if (editor) {
let component = this.htmlEditorSetting['parentComponent'] as MD2HtmlEditorComponent;
editor.ui.registry.addButton('customInsertButton', {
icon: 'code-sample',
text: 'MD2 Icon',
onAction: (_) => component.showInsertMD2Icon(editor)
onAction: (_) => component.showInsertMD2Icon(this.editor as any)
});
}
}
showInsertMD2Icon(editor: Editor) {
var iconKeys = Object.keys(MD2Icon);
iconKeys = iconKeys.slice(iconKeys.length / 2, iconKeys.length - 1);
this.msgBoxService.showInputbox('Insert MD2 Icon', '', { inputType: 'dropdown', dropDownOptions: iconKeys.map(k => new DropDownOption(k, k)) })
this.ngZone.run(_ => {
this.msgBoxService.showInputbox('Insert MD2 Icon', '', { inputType: 'dropdown', dropDownOptions: iconKeys.map((k, i) => new DropDownOption(i, k)) })
.pipe(first()).subscribe(result => {
editor.insertContent(`&nbsp;<strong>${result}</strong>&nbsp;`);
editor.insertContent(`<span class="MD2Icon mceNonEditable">${String.fromCharCode(65 + result)}</span>`);
this.writeValue(editor.getContent());
});
});
}
validate(control: AbstractControl): ValidationErrors {
// if (this.required && (this.value == null || this.value == 0)) {
// return { 'currency': '' };
// }
return null;
private _elementRef2: ElementRef;
writeValue(value: string | null): void {
super.writeValue(value);
}
registerOnValidatorChange?(fn: () => void): void {
}
onChange = (value: number) => { };
onTouched = () => { };
writeValue(obj: string): void {
this.data = obj;
}
registerOnChange(fn: any): void {
this.onChange = fn;
registerOnChange(fn: (value: string) => void): void {
super.registerOnChange(fn);
}
registerOnTouched(fn: any): void {
this.onTouched = fn;
super.registerOnTouched(fn);
}
setDisabledState?(isDisabled: boolean): void {
this.readonly = isDisabled;
setDisabledState(isDisabled: boolean): void {
super.setDisabledState(isDisabled);
}
ngOnInit() {
checkDomAttachment(): boolean {
// check if component has been attached to DOM yet
return document.body.contains(this._elementRef2.nativeElement);
}
ngAfterViewInit() {
this.renderer.removeAttribute(this.elementRef.nativeElement, 'id')
}
onBlur() {
if (this._lastBlurValue != this.data) {
this._lastBlurValue = this.data;
this.blur.emit(this.data);
this.init = this.htmlEditorSetting;
//this.htmlEditorSetup();
super.ngAfterViewInit();
}
private InitializeEditor() {
this.init = new HtmlEditorSettings({});
//super.initialise();
}
}

View File

@ -1,4 +1,4 @@
import { RawEditorOptions } from "tinymce";
import { Editor, RawEditorOptions } from "tinymce";
export class HtmlEditorSettings implements RawEditorOptions {
parentComponent?: any = null;
@ -34,7 +34,7 @@ export class HtmlEditorSettings implements RawEditorOptions {
'.parameterInput:empty:not(:focus):before { content: \' \' attr(data-name) \' (Empty)\'; }';
extended_valid_elements?: string = `parameter[id|style|class]`;
setup?: any;
constructor(config: Partial<HtmlEditorSettings>) {

View File

@ -1,13 +1,13 @@
@font-face {
font-family: "Massive Darkness 2";
src: url("https://api.happiness.tours/Files/Fonts/MassiveDarkness2.otf") format("opentype");
src: url("https://api.golife.love/Files/Fonts/MassiveDarkness2.otf") format("opentype");
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: "DwarvenAxeBBW00-Regular";
src: url("https://api.happiness.tours/Files/Fonts/MD2Font.ttf") format("opentype");
src: url("https://api.golife.love/Files/Fonts/MD2Font.ttf") format("opentype");
font-weight: normal;
font-style: normal;
}

View File

@ -6,11 +6,11 @@
const LINE_CLIENT_ID = '1657422139';
export const environment = {
production: true,
apiUrl: "https://api.happiness.tours",
signalRUrl: "https://api.happiness.tours",
invitationUrl: "https://happiness.tours/invitation/",
apiUrl: "https://api.golife.love",
signalRUrl: "https://api.golife.love",
invitationUrl: "https://golife.love/invitation/",
GAPI_CLIENT_ID: "93084169278-tp30i81laf1nu1mpgrc6m2o5sm32e28t.apps.googleusercontent.com",
GAPI_LOGIN_CALL_BACK: "https://happiness.tours/auth/googleLoginCallback",
GAPI_LOGIN_CALL_BACK: "https://golife.love/auth/googleLoginCallback",
LINE_CLIENT_ID: LINE_CLIENT_ID,
LINE_LOGIN_URL: `https://access.line.me/oauth2/v2.1/authorize?response_type=code&client_id=${LINE_CLIENT_ID}&redirect_uri=https%3A%2F%2Fhappiness.tours%2Fauth%2FlineLogin&state=@STATE&scope=profile%20openid%20email%20%09`
LINE_LOGIN_URL: `https://access.line.me/oauth2/v2.1/authorize?response_type=code&client_id=${LINE_CLIENT_ID}&redirect_uri=https%3A%2F%2Fgolife.love%2Fauth%2FlineLogin&state=@STATE&scope=profile%20openid%20email%20%09`
};

View File

@ -10,7 +10,7 @@
const urls = [
'https://localhost:44374',//IIS express
"https://localhost:49155",//Docker debug
'https://api.happiness.tours'
'https://api.golife.love'
];
const LINE_CLIENT_ID = '1657422139';
const dockerDebug = urls[2];
@ -22,7 +22,7 @@ export const environment = {
GAPI_CLIENT_ID: "93084169278-tp30i81laf1nu1mpgrc6m2o5sm32e28t.apps.googleusercontent.com",
GAPI_LOGIN_CALL_BACK: "http://localhost:4200/auth/googleLoginCallback",
LINE_CLIENT_ID: LINE_CLIENT_ID,
LINE_LOGIN_URL: `https://access.line.me/oauth2/v2.1/authorize?response_type=code&client_id=${LINE_CLIENT_ID}&redirect_uri=https%3A%2F%2Fhappiness.tours%2Fauth%2FlineLogin&state=@STATE&scope=profile%20openid%20email%20%09`
LINE_LOGIN_URL: `https://access.line.me/oauth2/v2.1/authorize?response_type=code&client_id=${LINE_CLIENT_ID}&redirect_uri=https%3A%2F%2Fgolife.love%2Fauth%2FlineLogin&state=@STATE&scope=profile%20openid%20email%20%09`
};
//lineLogin
//https://access.line.me/oauth2/v2.1/authorize?response_type=code&client_id=1657422139&redirect_uri=https%3A%2F%2Fhappiness.tours%2Fauth%2FlineLogin&state=awefwe23321412&scope=profile%20openid%20email%20%09
//https://access.line.me/oauth2/v2.1/authorize?response_type=code&client_id=1657422139&redirect_uri=https%3A%2F%2Fgolife.love%2Fauth%2FlineLogin&state=awefwe23321412&scope=profile%20openid%20email%20%09