@fieldnotes/core 0.50.0 → 0.50.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +13 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1123,6 +1123,6 @@ declare class LaserTool implements Tool {
|
|
|
1123
1123
|
private notifyOptionsChange;
|
|
1124
1124
|
}
|
|
1125
1125
|
|
|
1126
|
-
declare const VERSION = "0.50.
|
|
1126
|
+
declare const VERSION = "0.50.1";
|
|
1127
1127
|
|
|
1128
1128
|
export { type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, type BackgroundOptions, type BackgroundPattern, type Binding, type Bounds, Camera, type CameraChangeInfo, type CameraOptions, type CanvasElement, type CanvasState, type Command, DEFAULT_NOTE_FONT_SIZE, type DistributeAxis, type ElementChangeMeta, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportImageOptions, type ExportSvgOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, IndexedDBAdapter, type IndexedDBAdapterOptions, LaserTool, type LaserToolOptions, type Layer, LayerManager, LocalStorageAdapter, MeasureTool, type MeasureToolOptions, type Measurement, MemoryAdapter, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, type RenderStatsSnapshot, type RotateDirection, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StorageAdapter, type StrokeElement, type StrokePoint, type TemplateElement, type TemplateRenderStyle, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, VERSION, Viewport, type ViewportOptions, boundsIntersect, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, exportImage, exportSvg, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInRectangle, getHexCellsInSquare, getHexDistance, isNearBezier, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|
package/dist/index.d.ts
CHANGED
|
@@ -1123,6 +1123,6 @@ declare class LaserTool implements Tool {
|
|
|
1123
1123
|
private notifyOptionsChange;
|
|
1124
1124
|
}
|
|
1125
1125
|
|
|
1126
|
-
declare const VERSION = "0.50.
|
|
1126
|
+
declare const VERSION = "0.50.1";
|
|
1127
1127
|
|
|
1128
1128
|
export { type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, type BackgroundOptions, type BackgroundPattern, type Binding, type Bounds, Camera, type CameraChangeInfo, type CameraOptions, type CanvasElement, type CanvasState, type Command, DEFAULT_NOTE_FONT_SIZE, type DistributeAxis, type ElementChangeMeta, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportImageOptions, type ExportSvgOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, IndexedDBAdapter, type IndexedDBAdapterOptions, LaserTool, type LaserToolOptions, type Layer, LayerManager, LocalStorageAdapter, MeasureTool, type MeasureToolOptions, type Measurement, MemoryAdapter, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, type RenderStatsSnapshot, type RotateDirection, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StorageAdapter, type StrokeElement, type StrokePoint, type TemplateElement, type TemplateRenderStyle, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, VERSION, Viewport, type ViewportOptions, boundsIntersect, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, exportImage, exportSvg, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInRectangle, getHexCellsInSquare, getHexDistance, isNearBezier, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|
package/dist/index.js
CHANGED
|
@@ -280,7 +280,7 @@ function migrateElement(obj) {
|
|
|
280
280
|
if (obj["type"] === "note" && typeof obj["textColor"] !== "string") {
|
|
281
281
|
obj["textColor"] = "#000000";
|
|
282
282
|
}
|
|
283
|
-
if (obj["type"] === "note" && typeof obj["text"] === "string") {
|
|
283
|
+
if ((obj["type"] === "note" || obj["type"] === "text") && typeof obj["text"] === "string") {
|
|
284
284
|
obj["text"] = sanitizeNoteHtml(obj["text"]);
|
|
285
285
|
}
|
|
286
286
|
}
|
|
@@ -2493,6 +2493,11 @@ function transferStrokeRenderData(prev, next) {
|
|
|
2493
2493
|
}
|
|
2494
2494
|
|
|
2495
2495
|
// src/elements/element-store.ts
|
|
2496
|
+
function sanitizeRichText(element) {
|
|
2497
|
+
if (element.type !== "note" && element.type !== "text") return element;
|
|
2498
|
+
const text = sanitizeNoteHtml(element.text);
|
|
2499
|
+
return text === element.text ? element : { ...element, text };
|
|
2500
|
+
}
|
|
2496
2501
|
var ElementStore = class {
|
|
2497
2502
|
elements = /* @__PURE__ */ new Map();
|
|
2498
2503
|
bus = new EventBus();
|
|
@@ -2537,6 +2542,7 @@ var ElementStore = class {
|
|
|
2537
2542
|
return angle === 0 ? bounds : rotatedAABB(bounds, angle);
|
|
2538
2543
|
}
|
|
2539
2544
|
add(element, meta) {
|
|
2545
|
+
element = sanitizeRichText(element);
|
|
2540
2546
|
this.sortedCache = null;
|
|
2541
2547
|
this._versions.set(element.id, 0);
|
|
2542
2548
|
this.elements.set(element.id, element);
|
|
@@ -2563,7 +2569,7 @@ var ElementStore = class {
|
|
|
2563
2569
|
const arrow = updated;
|
|
2564
2570
|
arrow.cachedControlPoint = getArrowControlPoint(arrow.from, arrow.to, arrow.bend);
|
|
2565
2571
|
}
|
|
2566
|
-
if (updated.type === "note" && "text" in partial) {
|
|
2572
|
+
if ((updated.type === "note" || updated.type === "text") && "text" in partial) {
|
|
2567
2573
|
updated.text = sanitizeNoteHtml(updated.text);
|
|
2568
2574
|
}
|
|
2569
2575
|
this.elements.set(id, updated);
|
|
@@ -2593,11 +2599,12 @@ var ElementStore = class {
|
|
|
2593
2599
|
return this.getAll().map((el) => ({ ...el }));
|
|
2594
2600
|
}
|
|
2595
2601
|
loadSnapshot(elements, meta) {
|
|
2602
|
+
const sanitizedElements = elements.map(sanitizeRichText);
|
|
2596
2603
|
this.sortedCache = null;
|
|
2597
2604
|
this._versions.clear();
|
|
2598
2605
|
this.elements.clear();
|
|
2599
2606
|
this.spatialIndex.clear();
|
|
2600
|
-
for (const el of
|
|
2607
|
+
for (const el of sanitizedElements) {
|
|
2601
2608
|
this.elements.set(el.id, el);
|
|
2602
2609
|
this._versions.set(el.id, 0);
|
|
2603
2610
|
const bounds = this.indexBounds(el);
|
|
@@ -2610,7 +2617,7 @@ var ElementStore = class {
|
|
|
2610
2617
|
}
|
|
2611
2618
|
}
|
|
2612
2619
|
this.bus.emit("clear", null, meta);
|
|
2613
|
-
for (const el of
|
|
2620
|
+
for (const el of sanitizedElements) {
|
|
2614
2621
|
this.bus.emit("add", el, meta);
|
|
2615
2622
|
}
|
|
2616
2623
|
}
|
|
@@ -4025,7 +4032,7 @@ function createText(input) {
|
|
|
4025
4032
|
locked: input.locked ?? false,
|
|
4026
4033
|
layerId: input.layerId ?? "",
|
|
4027
4034
|
size: input.size ?? { w: 200, h: 28 },
|
|
4028
|
-
text: input.text ?? "",
|
|
4035
|
+
text: sanitizeNoteHtml(input.text ?? ""),
|
|
4029
4036
|
fontSize: input.fontSize ?? 16,
|
|
4030
4037
|
color: input.color ?? "#1a1a1a",
|
|
4031
4038
|
textAlign: input.textAlign ?? "left"
|
|
@@ -10527,7 +10534,7 @@ var LaserTool = class {
|
|
|
10527
10534
|
};
|
|
10528
10535
|
|
|
10529
10536
|
// src/index.ts
|
|
10530
|
-
var VERSION = "0.50.
|
|
10537
|
+
var VERSION = "0.50.1";
|
|
10531
10538
|
export {
|
|
10532
10539
|
ArrowTool,
|
|
10533
10540
|
AutoSave,
|