Commit 34d59929 authored by liujiaxin's avatar liujiaxin

feat: custom formula input

parent 4d9a6bcd
...@@ -8,6 +8,7 @@ import { ...@@ -8,6 +8,7 @@ import {
OnInit, Output, OnInit, Output,
ViewChild ViewChild
} from '@angular/core'; } from '@angular/core';
import {fromEvent, Observable, Subscription} from 'rxjs';
declare global { declare global {
interface Window { interface Window {
...@@ -18,6 +19,9 @@ declare global { ...@@ -18,6 +19,9 @@ declare global {
} }
} }
@Component({ @Component({
selector: 'app-formula-input', selector: 'app-formula-input',
templateUrl: './formula-input.component.html', templateUrl: './formula-input.component.html',
...@@ -36,6 +40,10 @@ export class FormulaInputComponent implements OnInit, OnChanges, OnDestroy, Afte ...@@ -36,6 +40,10 @@ export class FormulaInputComponent implements OnInit, OnChanges, OnDestroy, Afte
@Output() ngfBlur = new EventEmitter(); @Output() ngfBlur = new EventEmitter();
FB_id = 'FormulaBoard'; FB_id = 'FormulaBoard';
private esc: Subscription;
constructor() { constructor() {
...@@ -78,23 +86,25 @@ export class FormulaInputComponent implements OnInit, OnChanges, OnDestroy, Afte ...@@ -78,23 +86,25 @@ export class FormulaInputComponent implements OnInit, OnChanges, OnDestroy, Afte
id: this.FB_id, id: this.FB_id,
path: 'assets/formula-board/', path: 'assets/formula-board/',
options: { options: {
width: 600, width: 1920,
mode: 'android', mode: 'pc',
bottom: false, bottom: false,
}}); }});
document.addEventListener('documentMessage', (e) => { document.addEventListener('documentMessage', (e) => {
// @ts-ignore // @ts-ignore
if (e.detail.type === 'common.setFormula') { const {type} = e.detail;
if (type === 'common.setFormula') {
// @ts-ignore // @ts-ignore
const {formula} = e.detail.data.body; const {formula} = e.detail.data.body;
console.log(formula); console.log(formula);
window.FBOARD.clear(); window.FBOARD.clear();
// @ts-ignore // @ts-ignore
window.__tmp_fp_input_model__.updateValue(formula); window.__tmp_fp_input_model__.updateValue(formula);
const fb = document.getElementById(this.FB_id); window.FBOARD.editor.style.visibility = 'hidden';
fb.style.visibility = 'hidden'; this.ngfBlur.emit();
this.ngfBlur.emit(); }
if (type === 'common.closeModal') {
window.FBOARD.editor.style.visibility = 'hidden';
} }
}); });
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
/*visibility: visible!important;*/ /*visibility: visible!important;*/
/*position: relative!important;*/ /*position: relative!important;*/
transition: none; transition: none;
transform: scale(.8)!important;
transform-origin: left top!important;
} }
.kf-placeholder{ .kf-placeholder{
display: none!important; display: none!important;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment