feat: OneNote-style notebooks, text fonts, and page navigation
All checks were successful
CI / Windows build (push) Successful in 8m42s
All checks were successful
CI / Windows build (push) Successful in 8m42s
Add notebook.json containers with multi-member pages, fix PDF text editing (size/bold/drag/double-tap), index SidecarText in search, and share keyboard page shortcuts plus a PDF scrubber. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -121,6 +121,8 @@ class SidecarText {
|
||||
required this.text,
|
||||
this.fontSize = 0.03,
|
||||
this.color = 0xFF000000,
|
||||
this.fontWeight = 400,
|
||||
this.fontFamily,
|
||||
});
|
||||
|
||||
/// Stable id (uuid) so edits/deletes address a specific box.
|
||||
@@ -141,6 +143,12 @@ class SidecarText {
|
||||
/// ARGB text color.
|
||||
final int color;
|
||||
|
||||
/// CSS-like numeric weight (100–900). Default 400 (regular).
|
||||
final int fontWeight;
|
||||
|
||||
/// Optional family name. Null → editor default (IBM Plex Sans).
|
||||
final String? fontFamily;
|
||||
|
||||
SidecarText copyWith({
|
||||
String? id,
|
||||
double? nx,
|
||||
@@ -148,6 +156,9 @@ class SidecarText {
|
||||
String? text,
|
||||
double? fontSize,
|
||||
int? color,
|
||||
int? fontWeight,
|
||||
String? fontFamily,
|
||||
bool clearFontFamily = false,
|
||||
}) =>
|
||||
SidecarText(
|
||||
id: id ?? this.id,
|
||||
@@ -156,6 +167,9 @@ class SidecarText {
|
||||
text: text ?? this.text,
|
||||
fontSize: fontSize ?? this.fontSize,
|
||||
color: color ?? this.color,
|
||||
fontWeight: fontWeight ?? this.fontWeight,
|
||||
fontFamily:
|
||||
clearFontFamily ? null : (fontFamily ?? this.fontFamily),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
@@ -165,6 +179,8 @@ class SidecarText {
|
||||
'text': text,
|
||||
'fontSize': fontSize,
|
||||
'color': color,
|
||||
'fontWeight': fontWeight,
|
||||
if (fontFamily != null) 'fontFamily': fontFamily,
|
||||
};
|
||||
|
||||
factory SidecarText.fromJson(Map<String, dynamic> json) => SidecarText(
|
||||
@@ -174,6 +190,8 @@ class SidecarText {
|
||||
text: (json['text'] as String?) ?? '',
|
||||
fontSize: (json['fontSize'] as num?)?.toDouble() ?? 0.03,
|
||||
color: (json['color'] as num?)?.toInt() ?? 0xFF000000,
|
||||
fontWeight: (json['fontWeight'] as num?)?.toInt() ?? 400,
|
||||
fontFamily: json['fontFamily'] as String?,
|
||||
);
|
||||
|
||||
@override
|
||||
@@ -186,15 +204,26 @@ class SidecarText {
|
||||
ny == other.ny &&
|
||||
text == other.text &&
|
||||
fontSize == other.fontSize &&
|
||||
color == other.color;
|
||||
color == other.color &&
|
||||
fontWeight == other.fontWeight &&
|
||||
fontFamily == other.fontFamily;
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(id, nx, ny, text, fontSize, color);
|
||||
int get hashCode => Object.hash(
|
||||
id,
|
||||
nx,
|
||||
ny,
|
||||
text,
|
||||
fontSize,
|
||||
color,
|
||||
fontWeight,
|
||||
fontFamily,
|
||||
);
|
||||
|
||||
@override
|
||||
String toString() =>
|
||||
'SidecarText(id: $id, nx: $nx, ny: $ny, text: $text, '
|
||||
'fontSize: $fontSize, color: $color)';
|
||||
'fontSize: $fontSize, weight: $fontWeight, family: $fontFamily)';
|
||||
}
|
||||
|
||||
/// An anchor's private infinite scratchpad: a list of [InkStroke]s in ABSOLUTE
|
||||
|
||||
Reference in New Issue
Block a user