@@ -1261,12 +1280,12 @@ interface TemplateOpts extends FieldOpts {
export class FieldFuncs {
- private static calculateFontSize = (contWidth: number, contHeight: number, text: string, uppercase: boolean): number => {
+ public static calculateFontSize = (contWidth: number, contHeight: number, text: string, uppercase: boolean): number => {
const words: string[] = text.split(/\s+/).filter(Boolean);
let currFontSize = 1;
let rowsCount = 1;
- let currTextHeight = currFontSize * rowsCount * (uppercase ? 1.25 : 1);
+ let currTextHeight = currFontSize * rowsCount * 2;
while (currTextHeight <= contHeight) {
let wordIndex = 0;
@@ -1276,7 +1295,8 @@ export class FieldFuncs {
while (wordIndex < words.length) {
const word = words[wordIndex];
- const wordWidth = word.length * currFontSize;
+ const wordWidth = word.length * currFontSize * .5;
+ //console.log(wordWidth)
if (currentRowWidth + wordWidth <= contWidth) {
currentRowWidth += wordWidth;
@@ -1291,11 +1311,11 @@ export class FieldFuncs {
}
}
- wordIndex++;
+ wordIndex++;
}
- currTextHeight = rowsCount * currFontSize * (uppercase ? 1.25 : 1);
- //console.log(rowsCount, currTextHeight)
+ currTextHeight = rowsCount * currFontSize * 2;
+ //console.log(rowsCount, currFontSize, currTextHeight)
currFontSize += 1;
}
@@ -1312,6 +1332,7 @@ export class FieldFuncs {
const width = r - l;
const height = b - t;
const coord = {x: l, y: t};
+ console.log(coords, parentWidth, parentHeight, height);
return {width, height, coord};
}
@@ -1378,6 +1399,7 @@ export class FieldFuncs {
title: title,
x: coord.x,
y: coord.y,
+ _layout_fitWidth: false,
backgroundColor: opts.backgroundColor ?? '',
_layout_borderRounding: `${opts.cornerRounding}px` ?? '0px',
borderColor: opts.borderColor,
@@ -1386,6 +1408,8 @@ export class FieldFuncs {
_rotation: opts.rotation,
});
+ //setTimeout(() => {doc._height = height; doc._width = width}, 10);
+
return doc;
}
@@ -1415,8 +1439,12 @@ export class TemplateLayouts {
return TemplateLayouts.FourField002;
case 'fourfield3':
return TemplateLayouts.FourField003;
+ case 'fourfield4':
+ return TemplateLayouts.FourField004;
case 'threefield1':
return TemplateLayouts.ThreeField001;
+ case 'threefield2':
+ return TemplateLayouts.ThreeField002;
default:
break;
}
@@ -1427,11 +1455,11 @@ export class TemplateLayouts {
public static FourField001: TemplateDocInfos = {
title: 'fourfield1',
width: 416,
- height: 721,
+ height: 700,
opts: {
- backgroundColor: '#7B8D62',
+ backgroundColor: '#C0B887',
cornerRounding: 20,
- borderColor: '#642B00',
+ borderColor: '#6B461F',
borderWidth: '12',
},
fields: [{
@@ -1454,13 +1482,13 @@ export class TemplateLayouts {
description: 'The main focus of the template; could be an image, long text, etc.',
opts: {
cornerRounding: 20,
- borderColor: '#642B00',
+ borderColor: '#8F5B25',
borderWidth: '6',
backgroundColor: '#CECAB9',
}
}, {
tl: [-.8, .2],
- br: [.8, .35],
+ br: [.8, .3],
types: [TemplateFieldType.TEXT],
sizes: [TemplateFieldSize.TINY, TemplateFieldSize.SMALL],
description: 'A caption for field #2, very short to short text that contextualizes the content of field #2',
@@ -1474,10 +1502,10 @@ export class TemplateLayouts {
br: [.87, .96],
types: [TemplateFieldType.TEXT, TemplateFieldType.VISUAL],
sizes: [TemplateFieldSize.MEDIUM, TemplateFieldSize.LARGE, TemplateFieldSize.HUGE],
- description: 'A medium-sized field for medium/long text or a secondary image that complements the main focus.',
+ description: 'A medium-sized field for medium/long text.',
opts: {
cornerRounding: 15,
- borderColor: '#642B00',
+ borderColor: '#8F5B25',
borderWidth: '6',
backgroundColor: '#CECAB9',
}
@@ -1497,28 +1525,28 @@ export class TemplateLayouts {
br: [.83, -.2],
types: [TemplateFieldType.VISUAL, TemplateFieldType.TEXT],
sizes: [TemplateFieldSize.MEDIUM, TemplateFieldSize.LARGE],
- description: '',
+ description: 'A medium to large-sized field suitable for an image or longer text that should be the main focus.',
opts: {
borderWidth: '8',
borderColor: '#F8E71C',
}
}, {
- tl: [-.45, -.18],
- br: [.45, 0],
+ tl: [-.65, -.2],
+ br: [.65, -.02],
types: [TemplateFieldType.TEXT],
- sizes: [TemplateFieldSize.TINY, TemplateFieldSize.SMALL],
- description: '',
+ sizes: [TemplateFieldSize.TINY],
+ description: 'A tiny field for just a word or two of plain text.',
opts: {
backgroundColor: 'transparent',
color: 'white',
contentXCentering: 'h-center'
}
}, {
- tl: [-.45, 0],
- br: [.45, .18],
+ tl: [-.65, 0],
+ br: [.65, .18],
types: [TemplateFieldType.TEXT],
- sizes: [TemplateFieldSize.TINY, TemplateFieldSize.SMALL],
- description: '',
+ sizes: [TemplateFieldSize.TINY],
+ description: 'A tiny field for just a word or two of plain text.',
opts: {
backgroundColor: 'transparent',
color: 'white',
@@ -1529,11 +1557,12 @@ export class TemplateLayouts {
br: [.83, .95],
types: [TemplateFieldType.TEXT, TemplateFieldType.VISUAL],
sizes: [TemplateFieldSize.MEDIUM, TemplateFieldSize.LARGE, TemplateFieldSize.HUGE],
- description: '',
+ description: 'A medium to large-sized field suitable for an image or longer text that should be the main focus, or share focus with field 1.',
opts: {
borderWidth: '8',
borderColor: '#F8E71C',
- backgroundColor: '#242425'
+ color: 'white',
+ backgroundColor: '#242425',
}
}],
decorations: [{
@@ -1612,7 +1641,8 @@ export class TemplateLayouts {
description: '',
opts: {
backgroundColor: 'transparent',
- color: 'white',
+ color: 'red',
+ fontTransform: 'uppercase',
contentXCentering: 'h-left'
}
}, {
@@ -1635,6 +1665,72 @@ export class TemplateLayouts {
}]
};
+ public static FourField004: TemplateDocInfos = {
+ title: 'fourfield4',
+ width: 414,
+ height: 583,
+ opts: {
+ backgroundColor: '#6CCAF0',
+ borderColor: '#1088C3',
+ borderWidth: '10'
+ },
+ fields: [{
+ tl: [-.86, -.92],
+ br: [-.075, -.77],
+ types: [TemplateFieldType.TEXT],
+ sizes: [TemplateFieldSize.TINY],
+ description: 'A tiny field for just a word or two of plain text.',
+ opts: {
+ backgroundColor: '#E2B4F5',
+ borderWidth: '9',
+ borderColor: '#9222F1',
+ contentXCentering: 'h-center'
+ }
+ }, {
+ tl: [.075, -.92],
+ br: [.86, -.77],
+ types: [TemplateFieldType.TEXT],
+ sizes: [TemplateFieldSize.TINY],
+ description: 'A tiny field for just a word or two of plain text.',
+ opts: {
+ backgroundColor: '#F5B4DD',
+ borderWidth: '9',
+ borderColor: '#E260F3',
+ contentXCentering: 'h-center'
+ }
+ }, {
+ tl: [-.81, -.64],
+ br: [.81, .48],
+ types: [TemplateFieldType.VISUAL],
+ sizes: [TemplateFieldSize.MEDIUM, TemplateFieldSize.LARGE, TemplateFieldSize.HUGE],
+ description: 'A large to huge field for visual content that is the main content of the template.',
+ opts: {
+ borderWidth: '16',
+ borderColor: '#A2BD77',
+ }
+ }, {
+ tl: [-.86, .6],
+ br: [.86, .92],
+ types: [TemplateFieldType.TEXT],
+ sizes: [TemplateFieldSize.MEDIUM, TemplateFieldSize.LARGE],
+ description: 'A medium to large field for text that describes the visual content above',
+ opts: {
+ borderWidth: '9',
+ borderColor: '#F0D601',
+ backgroundColor: '#F3F57D',
+ }
+ }],
+ decorations: [{
+ tl: [-.852, -.67],
+ br: [.852, .51],
+ opts: {
+ backgroundColor: 'transparent',
+ borderColor: '#007C0C',
+ borderWidth: '10',
+ }
+ }]
+ };
+
public static ThreeField001: TemplateDocInfos = {
title: 'threefield1',
width: 575,
@@ -1646,8 +1742,8 @@ export class TemplateLayouts {
tl: [-.66, -.747],
br: [.66, .247],
types: [TemplateFieldType.VISUAL],
- sizes: [TemplateFieldSize.LARGE, TemplateFieldSize.HUGE],
- description: '',
+ sizes: [TemplateFieldSize.MEDIUM, TemplateFieldSize.LARGE, TemplateFieldSize.HUGE],
+ description: 'A medium to large field for visual content that is the central focus.',
opts: {
borderColor: 'yellow',
borderWidth: '8',
@@ -1670,7 +1766,7 @@ export class TemplateLayouts {
br: [.7, .46],
types: [TemplateFieldType.TEXT],
sizes: [TemplateFieldSize.TINY, TemplateFieldSize.SMALL],
- description: '',
+ description: 'A very small text field for one to a few words. A good caption for the image.',
opts: {
backgroundColor: 'transparent',
contentXCentering: 'h-center',
@@ -1680,7 +1776,7 @@ export class TemplateLayouts {
br: [.95, .95],
types: [TemplateFieldType.TEXT],
sizes: [TemplateFieldSize.MEDIUM, TemplateFieldSize.LARGE],
- description: '',
+ description: 'A medium to large text field for a thorough description of the image. ',
opts: {
backgroundColor: 'transparent',
color: 'white'
@@ -1717,6 +1813,59 @@ export class TemplateLayouts {
}]
};
+ public static ThreeField002: TemplateDocInfos = {
+ title: 'threefield2',
+ width: 477,
+ height: 662,
+ opts: {
+ backgroundColor: '#9E9C95'
+ },
+ fields: [{
+ tl: [-.95, .8],
+ br: [-.1, .95],
+ types: [TemplateFieldType.VISUAL],
+ sizes: [TemplateFieldSize.MEDIUM, TemplateFieldSize.LARGE, TemplateFieldSize.HUGE],
+ description: '',
+ opts: {
+ backgroundColor: 'transparent',
+ color: 'white',
+ contentXCentering: 'h-right',
+ }
+ }, {
+ tl: [.1, .8],
+ br: [.95, .95],
+ types: [TemplateFieldType.TEXT],
+ sizes: [TemplateFieldSize.TINY, TemplateFieldSize.SMALL],
+ description: 'A very small text field for one to a few words. The content should represent a general categorization of the image.',
+ opts: {
+ backgroundColor: 'transparent',
+ color: 'red',
+ fontTransform: 'uppercase',
+ fontBold: true,
+ contentXCentering: 'h-left'
+ }
+ }, {
+ tl: [0, -.9],
+ br: [.85, -.66],
+ types: [TemplateFieldType.TEXT],
+ sizes: [TemplateFieldSize.TINY, TemplateFieldSize.SMALL],
+ description: 'A very small text field for one to a few words. The content should contextualize field 2.',
+ opts: {
+ backgroundColor: 'transparent',
+ contentXCentering: 'h-right'
+ }
+ }],
+ decorations: [{
+ tl: [-.025, .8],
+ br: [.025, .95],
+ opts: {
+ backgroundColor: '#E0E0DA',
+ }
+ }]
+ };
+
+
+
// public static FourField002: TemplateDocInfos = {
// width: 450,
// height: 600,
diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx
index faea05104..53aa7171f 100644
--- a/src/client/views/nodes/ImageBox.tsx
+++ b/src/client/views/nodes/ImageBox.tsx
@@ -123,15 +123,15 @@ export class ImageBox extends ViewBoxAnnotatableComponent() {
{ fireImmediately: true, delay: 1000 }
);
const { layoutDoc } = this;
- this._disposers.path = reaction(
- () => ({ nativeSize: this.nativeSize, width: NumCast(this.layoutDoc._width) }),
- ({ nativeSize, width }) => {
- if (layoutDoc === this.layoutDoc || !this.layoutDoc._height) {
- this.layoutDoc._height = (width * nativeSize.nativeHeight) / nativeSize.nativeWidth;
- }
- },
- { fireImmediately: true }
- );
+ // this._disposers.path = reaction(
+ // () => ({ nativeSize: this.nativeSize, width: NumCast(this.layoutDoc._width) }),
+ // ({ nativeSize, width }) => {
+ // if (layoutDoc === this.layoutDoc || !this.layoutDoc._height) {
+ // this.layoutDoc._height = (width * nativeSize.nativeHeight) / nativeSize.nativeWidth;
+ // }
+ // },
+ // { fireImmediately: true }
+ // );
this._disposers.scroll = reaction(
() => this.layoutDoc.layout_scrollTop,
sTop => {
@@ -394,7 +394,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent() {
alt=""
key="paths"
src={srcpath}
- style={{ transform, transformOrigin }}
+ style={{ transform, transformOrigin, objectFit: 'fill', height: '100%' }}
onError={action(e => {
this._error = e.toString();
})}
@@ -456,6 +456,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent() {
savedAnnotations = () => this._savedAnnotations;
render() {
+ console.log('img', this._props.PanelWidth(), this._props.PanelHeight())
TraceMobx();
const borderRad = this._props.styleProvider?.(this.layoutDoc, this._props, StyleProp.BorderRounding);
const borderRadius = borderRad?.includes('px') ? `${Number(borderRad.split('px')[0]) / (this._props.NativeDimScaling?.() || 1)}px` : borderRad;
@@ -475,7 +476,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent() {
})}
style={{
width: this._props.PanelWidth() ? undefined : `100%`,
- height: this._props.PanelWidth() ? undefined : `100%`,
+ height: this._props.PanelHeight() ? undefined : `100%`,
pointerEvents: this.layoutDoc._lockedPosition ? 'none' : undefined,
borderRadius,
overflow: this.layoutDoc.layout_fitWidth || this._props.fitWidth?.(this.Document) ? 'auto' : undefined,
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.scss b/src/client/views/nodes/formattedText/FormattedTextBox.scss
index d6fd81f83..72d550c7e 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.scss
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.scss
@@ -79,6 +79,7 @@ audiotag:hover {
transform-origin: left top;
top: 0;
left: 0;
+
}
.formattedTextBox-cont {
--
cgit v1.2.3-70-g09d2
From e7235baa7ed998908dec8bf48e4c244594aa76bb Mon Sep 17 00:00:00 2001
From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com>
Date: Sun, 8 Sep 2024 18:42:12 -0400
Subject: schema changes reverted
---
.../collectionSchema/CollectionSchemaView.tsx | 3 +-
.../collectionSchema/SchemaCellField.tsx | 123 +--------------------
.../collectionSchema/SchemaColumnHeader.tsx | 2 +-
.../collections/collectionSchema/SchemaRowBox.tsx | 5 +-
.../collectionSchema/SchemaTableCell.tsx | 2 +-
.../views/nodes/DataVizBox/DocCreatorMenu.tsx | 9 +-
.../views/nodes/formattedText/FormattedTextBox.tsx | 2 +-
7 files changed, 16 insertions(+), 130 deletions(-)
(limited to 'src/client/views/nodes/formattedText')
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index 12c342b9f..59ccec71f 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -46,7 +46,6 @@ import { SchemaCellField } from './SchemaCellField';
import { threadId } from 'worker_threads';
import { FontIconBox } from '../../nodes/FontIconBox/FontIconBox';
-// eslint-disable-next-line @typescript-eslint/no-var-requires
const { SCHEMA_NEW_NODE_HEIGHT } = require('../../global/globalCssVariables.module.scss'); // prettier-ignore
export const FInfotoColType: { [key: string]: ColumnType } = {
@@ -1539,4 +1538,4 @@ class CollectionSchemaViewDocs extends React.Component
);
}
-}
+}
\ No newline at end of file
diff --git a/src/client/views/collections/collectionSchema/SchemaCellField.tsx b/src/client/views/collections/collectionSchema/SchemaCellField.tsx
index 3be9167fe..e1059b8fc 100644
--- a/src/client/views/collections/collectionSchema/SchemaCellField.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaCellField.tsx
@@ -8,15 +8,6 @@ import { FieldView, FieldViewProps } from "../../nodes/FieldView";
import { ObjectField } from "../../../../fields/ObjectField";
import { Doc } from "../../../../fields/Doc";
import { DocumentView } from "../../nodes/DocumentView";
-import { date } from "serializr";
-import { createRoot } from "react-dom/client";
-import DatePicker from "react-datepicker";
-import { emptyFunction } from "../../../../Utils";
-import { DateField } from "../../../../fields/DateField";
-
-enum EleType {
- plainText, fieldReference, date, boolean
-}
export interface SchemaCellFieldProps {
contents: any;
@@ -43,7 +34,6 @@ export class SchemaCellField extends ObservableReactComponent {
- // if (!this._inputref) return;
-
- // const dateRefs = Array.from(this._inputref.querySelectorAll('.date-placeholder'));
-
- // dateRefs.forEach(ref => {
- // const root = createRoot(ref);
- // root.render();
- // })
- // }
-
- generateSpan = (text: string, cell: HTMLDivElement | undefined): JSX.Element => {
+ generateSpan = (text: string, cell: HTMLDivElement | undefined) => {
const selfRef = text === this.selfRefPattern;
- const color: string | undefined = cell?.style.borderTop.replace('2px solid', '');
- return (
-
- {text}
-
- );
+ return `${text}`;
}
makeSpans = (content: string) => {
- const spans: JSX.Element[] = [];
let chunkedText = content;
const pattern = /(this|d(\d+))\.(\w+)/g;
@@ -170,93 +140,17 @@ export class SchemaCellField extends ObservableReactComponent {
- chunkedText = chunkedText.replace(match, '');
- spans.push(this.generateSpan(match, cells.get(match)));
+ chunkedText = chunkedText.replace(match, this.generateSpan(match, cells.get(match)));
++matchNum;
})
- chunkedText = chunkedText.replace(/{{date}}/g, `placeholder text`);
-
return chunkedText;
}
- verifyCellRef = (text: string): [string, HTMLDivElement | undefined] | undefined => {
- const pattern = /(this|d(\d+))\.(\w+)/g;
- let matchedText: string = '';
- let matchedCell: HTMLDivElement | undefined = undefined;
- let match: RegExpExecArray | null;
-
- while ((match = pattern.exec(text)) !== null) {
- const cells = this._props.getCells(match[0]);
- if (cells.length) {
- matchedText = match[0];
- matchedCell = cells[0];
- }
- }
-
- if (!matchedText && !matchedCell) return undefined;
- else return [matchedText, matchedCell];
- }
-
- elementsFromText = (chunks: string[]): JSX.Element[] => {
- const eles: any[] = [];
-
- chunks.forEach(text => {
- const cellRef = this.verifyCellRef(text);
- if (cellRef) {
- eles.push(this.generateSpan(cellRef[0], cellRef[1]));
- } else if (text && !text.replace('{{date}}', '')){
- eles.push();
- } else if (text && !text.replace('{{boolean}}', '')) {
- eles.push(boolean thing);
- } else {
- eles.push({text});
- }
- });
-
- return eles;
- }
-
- parseElements = (content: string) => {
- let string: string = content;
- if (string.startsWith(':')) string = string.slice(1);
- if (string.startsWith('=')) string = string.slice(1);
-
- const chunks: string[] = [];
-
- let subStr: string = '';
- let currChar = '';
- for (let i = 0; i < string.length; i++){
- currChar = string[i];
- if (((string.charCodeAt(i) === 32 || string.charCodeAt(i) === 160) && subStr.trim()) || (currChar !== ' ' && !subStr.trim())) {
- chunks.push(subStr);
- subStr = currChar;
- } else {
- subStr += currChar;
- }
- }
-
- if (subStr) {chunks.push(subStr)};
-
- return this.elementsFromText(chunks);
- }
-
- // ` | undefined) => {
- // if ((value?.nativeEvent as any).shiftKey) {
- // this._props.setColumnValues(this._props.fieldKey.replace(/^_/, ''), (color === 'black' ? '=' : '') + (value?.target?.checked.toString() ?? ''));
- // } else Doc.SetField(this._props.Document, this._props.fieldKey.replace(/^_/, ''), (color === 'black' ? '=' : '') + (value?.target?.checked.toString() ?? ''));
- // })}
- // />`
-
@action
setContent = (content: string, restoreCursorPos?: boolean) => {
const pos = this.cursorPosition;
- this._displayedContent = content;
- this._displayedElements = this.parseElements(content);
+ this._displayedContent = this.makeSpans(content);
restoreCursorPos && setTimeout(() => this.setCursorPosition(pos));
}
@@ -339,9 +233,8 @@ export class SchemaCellField extends ObservableReactComponent this.parseElements(this._displayedContent).length) this.setContent(targVal, true);
+ if (this.shouldUpdate(prevVal, targVal)) {this.setContent(targVal, true)};
this.setupRefSelect(this.refSelectConditionMet);
- console.log(this.parseElements(targVal));
};
setupRefSelect = (enabled: boolean) => {
@@ -458,12 +351,8 @@ export class SchemaCellField extends ObservableReactComponent e.stopPropagation}
onPointerUp={e => e.stopPropagation}
onPointerMove={e => {e.stopPropagation(); e.preventDefault()}}
- suppressContentEditableWarning={true}
- //dangerouslySetInnerHTML={{ __html: this._displayedContent }}
+ dangerouslySetInnerHTML={{ __html: this._displayedContent }}
>
- {this._displayedElements.map((ele, index) => {
- return {ele};
- })}
);
}
diff --git a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx
index 40509c41b..9f6478041 100644
--- a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx
@@ -249,4 +249,4 @@ export class SchemaColumnHeader extends ObservableReactComponent
);
}
-}
+}
\ No newline at end of file
diff --git a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
index 72f5d8c25..ec94a8077 100644
--- a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
@@ -24,7 +24,6 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { infoState } from '../collectionFreeForm/CollectionFreeFormInfoState';
import { TbShieldX } from 'react-icons/tb';
-import { DocumentType } from '../../../documents/DocumentTypes';
interface SchemaRowBoxProps extends FieldViewProps {
rowIndex: number;
@@ -78,7 +77,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent() {
icon: 'minus',
});
const childDocs = DocListCast(this.Document[Doc.LayoutFieldKey(this.Document)])
- if (childDocs.length) {
+ if (this.Document.type === 'collection' && childDocs.length) {
ContextMenu.Instance.addItem({
description: this.Document._childrenSharedWithSchema ? 'Remove children from schema' : 'Add children to schema',
event: () => {
@@ -197,4 +196,4 @@ export class SchemaRowBox extends ViewBoxBaseComponent() {
);
}
-}
+}
\ No newline at end of file
diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
index 7d29e40cc..e2a05da7f 100644
--- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
@@ -389,7 +389,7 @@ export class SchemaDateCell extends ObservableReactComponent
-
+
{pointerEvents === 'none' ? null : (
diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx
index dcdd52c73..8273f3e09 100644
--- a/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx
+++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx
@@ -375,7 +375,6 @@ export class DocCreatorMenu extends ObservableReactComponent {
if (res && this._callCount === origCount) {
this._suggestedTemplates = [];
- this._GPTLoading = false;
const templates: {template_type: string, fieldVals: {title: string, tlx: string, tly: string, brx: string, bry: string}[]}[] = JSON.parse(res);
this.createGeneratedTemplates(templates, 500, 500);
}
@@ -714,7 +713,7 @@ export class DocCreatorMenu extends ObservableReactComponent {
try {
const renderedImages: Doc[] = await Promise.all(
calls.map(async ([fieldNum, col]) => {
- const sysPrompt = 'Your job is to create a prompt for an AI image generator to help it generate an image based on existing content in a template and a user prompt. ONLY INCLUDE THE PROMPT, NO OTHER TEXT OR EXPLANATION. The existing content is as follows: ' + fieldContent + ' **** The user prompt is: ' + col.desc;
+ const sysPrompt = 'Your job is to create a prompt for an AI image generator to help it generate an image based on existing content in a template and a user prompt. Your prompt should focus heavily on visual elements to help the image generator; avoid unecessary info that might distract it. ONLY INCLUDE THE PROMPT, NO OTHER TEXT OR EXPLANATION. The existing content is as follows: ' + fieldContent + ' **** The user prompt is: ' + col.desc;
const prompt = await gptAPICall(sysPrompt, GPTCallType.COMPLETEPROMPT);
console.log(sysPrompt, prompt);
@@ -852,7 +851,6 @@ export class DocCreatorMenu extends ObservableReactComponent {
const res = await gptAPICall(prompt, GPTCallType.TEMPLATE);
if (res && this._callCount === origCount) {
- this._GPTLoading = false;
const assignments: {[templateTitle: string]: {[field: string]: string}} = JSON.parse(res);
const brokenDownAssignments: [TemplateDocInfos, {[field: number]: Col}][] = [];
@@ -889,7 +887,7 @@ export class DocCreatorMenu extends ObservableReactComponent {
const renderedTemplates: Doc[] = await Promise.all(renderedTemplatePromises);
- setTimeout(() => { this.setGSuggestedTemplates(renderedTemplates) });
+ setTimeout(() => { this.setGSuggestedTemplates(renderedTemplates); this._GPTLoading = false });
};
@action setExpandedView = (info: {icon: ImageField, doc: Doc} | undefined) => {
@@ -908,6 +906,7 @@ export class DocCreatorMenu extends ObservableReactComponent {
@@ -44,7 +44,7 @@ export class DocumentIcon extends ObservableReactComponent {
}
}
-@observer
+@observer
export class DocumentIconContainer extends React.Component {
public static getTransformer(): Transformer {
const usedDocuments = new Set();
diff --git a/src/client/views/nodes/FieldView.tsx b/src/client/views/nodes/FieldView.tsx
index ba85bfb68..741d63909 100644
--- a/src/client/views/nodes/FieldView.tsx
+++ b/src/client/views/nodes/FieldView.tsx
@@ -138,7 +138,7 @@ export class FieldView extends React.Component {
const field = this.fieldval;
// prettier-ignore
if (field instanceof Doc) return
{field.title?.toString()}
;
- if (field === undefined) return
{''}
;
+ if (field === undefined) return ;
if (field instanceof DateField) return
{field.date.toLocaleString()}
;
if (field instanceof List) return
{field.map(f => Field.toString(f)).join(', ')}
;
if (field instanceof WebField) return
{Field.toString(field.url.href)}
;
diff --git a/src/client/views/nodes/LabelBox.tsx b/src/client/views/nodes/LabelBox.tsx
index cfcf76b12..8974cccaf 100644
--- a/src/client/views/nodes/LabelBox.tsx
+++ b/src/client/views/nodes/LabelBox.tsx
@@ -2,7 +2,7 @@ import { Property } from 'csstype';
import { action, computed, makeObservable } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
-//import * as textfit from 'textfit';
+import * as textfit from 'textfit';
import { Field, FieldType } from '../../../fields/Doc';
import { BoolCast, NumCast, StrCast } from '../../../fields/Types';
import { TraceMobx } from '../../../fields/util';
@@ -96,7 +96,7 @@ export class LabelBox extends ViewBoxBaseComponent() {
this._timeout = setTimeout(() => this.fitTextToBox(r));
return textfitParams;
}
- //textfit(r, textfitParams);
+ textfit(r, textfitParams);
}
return textfitParams;
};
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index c1367aa0b..0d7914a82 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -1498,7 +1498,6 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent this._editorView!.focus()); // not sure why setTimeout is needed but editing dashFieldView's doesn't work without it.
-
}
// add user mark for any first character that was typed since the user mark that gets set in KeyPress won't have been called yet.
@@ -2087,7 +2086,6 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent