This commit is contained in:
Mr. Stallion 2020-03-15 10:22:55 -05:00
parent 56ad463f82
commit 99be1aaedd
4 changed files with 39 additions and 13 deletions

View File

@ -1,7 +1,7 @@
<template>
<div class="bbcode-editor" style="display:flex;flex-wrap:wrap;justify-content:flex-end">
<slot></slot>
<a v-show="hasToolbar" tabindex="0" class="btn btn-light bbcode-btn btn-sm" role="button" @click="showToolbar = true" @blur="showToolbar = false" style="border-bottom-left-radius:0;border-bottom-right-radius:0">
<a v-show="hasToolbar" tabindex="0" class="btn btn-light bbcode-btn btn-sm" role="button" @click="showToolbar = true" @blur="showToolbar = false" style="border-bottom-left-radius: 0; border-bottom-right-radius: 0">
<i class="fa fa-code"></i>
</a>
</div>
@ -20,20 +20,28 @@
export default class Editor extends Vue {
@Prop
readonly extras?: EditorButton[];
@Prop({default: 1000})
readonly maxlength!: number;
@Prop
readonly classes?: string;
@Prop
readonly value?: string | undefined;
@Prop
readonly disabled?: boolean;
@Prop
readonly placeholder?: string;
@Prop({default: true})
readonly hasToolbar!: boolean;
@Prop({default: false, type: Boolean})
readonly invalid!: boolean;
preview = false;
previewWarnings: ReadonlyArray<string> = [];
previewResult = '';
@ -44,8 +52,10 @@
maxHeight!: number;
minHeight!: number;
showToolbar = false;
protected parser!: BBCodeParser;
protected defaultButtons = defaultButtons;
private isShiftPressed = false;
private undoStack: string[] = [];
private undoIndex = 0;
@ -55,6 +65,7 @@
@Hook('created')
created(): void {
console.log('EDITOR', 'created');
this.parser = new CoreBBCodeParser();
this.resizeListener = () => {
const styles = getComputedStyle(this.element);
@ -65,6 +76,7 @@
@Hook('mounted')
mounted(): void {
console.log('EDITOR', 'mounted');
this.element = <HTMLTextAreaElement>this.$refs['input'];
const styles = getComputedStyle(this.element);
this.maxHeight = parseInt(styles.maxHeight, 10) || 250;
@ -91,6 +103,7 @@
@Hook('destroyed')
destroyed(): void {
console.log('EDITOR', 'destroyed');
window.removeEventListener('resize', this.resizeListener);
}

View File

@ -85,7 +85,7 @@
@Hook('mounted')
async mounted(): Promise<void> {
// top bar devtools
// browserWindow.webContents.openDevTools();
browserWindow.webContents.openDevTools();
await this.addTab();

View File

@ -41,7 +41,7 @@ import * as path from 'path';
import * as url from 'url';
import l from '../chat/localize';
import {defaultHost, GeneralSettings} from './common';
import {ensureDictionary, getAvailableDictionaries} from './dictionaries';
import {ensureDictionary, getAvailableDictionaries} from './dgit ictionaries';
import * as windowState from './window_state';
import BrowserWindow = Electron.BrowserWindow;
import MenuItem = Electron.MenuItem;
@ -126,17 +126,30 @@ function createWindow(): Electron.BrowserWindow | undefined {
...lastState, center: lastState.x === undefined, show: false,
webPreferences: { webviewTag: true, nodeIntegration: true }
};
if(process.platform === 'darwin') windowProperties.titleBarStyle = 'hiddenInset';
else windowProperties.frame = false;
if(process.platform === 'darwin') {
// windowProperties.titleBarStyle = 'hiddenInset';
windowProperties.frame = true;
} else {
windowProperties.frame = false;
}
const window = new electron.BrowserWindow(windowProperties);
windows.push(window);
window.loadURL(url.format({ //tslint:disable-line:no-floating-promises
pathname: path.join(__dirname, 'window.html'),
protocol: 'file:',
slashes: true,
query: {settings: JSON.stringify(settings), import: shouldImportSettings ? 'true' : []}
}));
window.loadFile(
path.join(__dirname, 'window.html'),
{
query: {settings: JSON.stringify(settings), import: shouldImportSettings ? 'true' : []}
}
);
// window.loadURL(url.format({ //tslint:disable-line:no-floating-promises
// pathname: path.join(__dirname, 'window.html'),
// protocol: 'file:',
// slashes: true,
// query: {settings: JSON.stringify(settings), import: shouldImportSettings ? 'true' : []}
// }));
setUpWebContents(window.webContents);

View File

@ -38,13 +38,13 @@
const id = parseInt(this.infotag.id as any, 10);
if ((core.state.settings.risingAdScore) && (this.characterMatch)) {
console.log('MATCH');
// console.log('MATCH');
const scores = this.theirInterestIsRelevant(id)
? this.characterMatch.them.scores
: (this.yourInterestIsRelevant(id) ? this.characterMatch.you.scores : null);
console.log('SCORES', scores);
// console.log('SCORES', scores);
if (scores) {
const score = scores[id];