From 3778a12ce6e9280cc0f6ffc66ede4c3bb57851fb Mon Sep 17 00:00:00 2001 From: Hsuan Lee Date: Tue, 7 Jan 2020 09:47:56 +0800 Subject: [PATCH] fix: convert code editor font size units --- .../code-editor/code-editor.component.ts | 3 ++- .../src/app/utility/css-unit-conversion.ts | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 zeppelin-web-angular/src/app/utility/css-unit-conversion.ts diff --git a/zeppelin-web-angular/src/app/pages/workspace/notebook/paragraph/code-editor/code-editor.component.ts b/zeppelin-web-angular/src/app/pages/workspace/notebook/paragraph/code-editor/code-editor.component.ts index 8cf4bd798b8..d238925543b 100644 --- a/zeppelin-web-angular/src/app/pages/workspace/notebook/paragraph/code-editor/code-editor.component.ts +++ b/zeppelin-web-angular/src/app/pages/workspace/notebook/paragraph/code-editor/code-editor.component.ts @@ -31,6 +31,7 @@ import IEditor = monaco.editor.IEditor; import { InterpreterBindingItem } from '@zeppelin/sdk'; import { CompletionService, MessageService } from '@zeppelin/services'; +import { pt2px } from '@zeppelin/utility/css-unit-conversion'; import { NotebookParagraphControlComponent } from '../control/control.component'; @Component({ @@ -139,7 +140,7 @@ export class NotebookParagraphCodeEditorComponent implements OnChanges, OnDestro if (this.editor) { this.editor.updateOptions({ readOnly: this.readOnly, - fontSize: this.fontSize, + fontSize: pt2px(this.fontSize), renderLineHighlight: this.focus ? 'all' : 'none', minimap: { enabled: false }, lineNumbers: this.lineNumbers ? 'on' : 'off', diff --git a/zeppelin-web-angular/src/app/utility/css-unit-conversion.ts b/zeppelin-web-angular/src/app/utility/css-unit-conversion.ts new file mode 100644 index 00000000000..19d4057f45c --- /dev/null +++ b/zeppelin-web-angular/src/app/utility/css-unit-conversion.ts @@ -0,0 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export function pt2px(pt: number): number { + return pt / (3 / 4); +}