mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-24 22:57:12 -04:00
Merge branch 'AppFlowy-IO:main' into main
This commit is contained in:
commit
a8b42cbc95
6 changed files with 26 additions and 17 deletions
|
@ -13,7 +13,7 @@ git clone https://github.com/AppFlowy-IO/appflowy.git
|
||||||
Note:
|
Note:
|
||||||
* Both Windows cmd and powershell can be used for running commands
|
* Both Windows cmd and powershell can be used for running commands
|
||||||
* Following steps are verified on
|
* Following steps are verified on
|
||||||
- [x] Windows 10 X86_64
|
- [ ] Windows 10 X86_64
|
||||||
- [ ] Windows 10 arm64
|
- [ ] Windows 10 arm64
|
||||||
- [ ] Windows 11 X86_64
|
- [ ] Windows 11 X86_64
|
||||||
- [ ] Windows 11 arm64
|
- [ ] Windows 11 arm64
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"appName": "Appflowy",
|
"appName": "AppFlowy",
|
||||||
"defaultUsername": "Me",
|
"defaultUsername": "Me",
|
||||||
"welcomeText": "Welcome to @:appName",
|
"welcomeText": "Welcome to @:appName",
|
||||||
"githubStarText": "Star on GitHub",
|
"githubStarText": "Star on GitHub",
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
},
|
},
|
||||||
"menuAppHeader": {
|
"menuAppHeader": {
|
||||||
"addPageTooltip": "Quickly add a page inside",
|
"addPageTooltip": "Quickly add a page inside",
|
||||||
"defaultNewPageName": "Untitles",
|
"defaultNewPageName": "Untitled",
|
||||||
"renameDialog": "Rename"
|
"renameDialog": "Rename"
|
||||||
},
|
},
|
||||||
"toolbar": {
|
"toolbar": {
|
||||||
|
|
|
@ -85,7 +85,7 @@ class CodegenLoader extends AssetLoader{
|
||||||
},
|
},
|
||||||
"menuAppHeader": {
|
"menuAppHeader": {
|
||||||
"addPageTooltip": "Quickly add a page inside",
|
"addPageTooltip": "Quickly add a page inside",
|
||||||
"defaultNewPageName": "Untitles",
|
"defaultNewPageName": "Untitled",
|
||||||
"renameDialog": "Rename"
|
"renameDialog": "Rename"
|
||||||
},
|
},
|
||||||
"toolbar": {
|
"toolbar": {
|
||||||
|
|
|
@ -65,8 +65,7 @@ class DeltaMarkdownEncoder extends Converter<String, String> {
|
||||||
// First close any current styles if needed
|
// First close any current styles if needed
|
||||||
final markedForRemoval = <Attribute>[];
|
final markedForRemoval = <Attribute>[];
|
||||||
// Close the styles in reverse order, e.g. **_ for _**Test**_.
|
// Close the styles in reverse order, e.g. **_ for _**Test**_.
|
||||||
for (final value
|
for (final value in currentInlineStyle.attributes.values.toList().reversed) {
|
||||||
in currentInlineStyle.attributes.values.toList().reversed) {
|
|
||||||
// TODO(tillf): Is block correct?
|
// TODO(tillf): Is block correct?
|
||||||
if (value.scope == AttributeScope.BLOCK) {
|
if (value.scope == AttributeScope.BLOCK) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -123,10 +122,8 @@ class DeltaMarkdownEncoder extends Converter<String, String> {
|
||||||
// Close any open inline styles.
|
// Close any open inline styles.
|
||||||
_handleInline(lineBuffer, '', null);
|
_handleInline(lineBuffer, '', null);
|
||||||
|
|
||||||
final lineBlock = Style.fromJson(attributes)
|
final lineBlock =
|
||||||
.attributes
|
Style.fromJson(attributes).attributes.values.singleWhereOrNull((a) => a.scope == AttributeScope.BLOCK);
|
||||||
.values
|
|
||||||
.singleWhereOrNull((a) => a.scope == AttributeScope.BLOCK);
|
|
||||||
|
|
||||||
if (lineBlock == currentBlockStyle) {
|
if (lineBlock == currentBlockStyle) {
|
||||||
currentBlockLines.add(lineBuffer.toString());
|
currentBlockLines.add(lineBuffer.toString());
|
||||||
|
@ -220,6 +217,16 @@ class DeltaMarkdownEncoder extends Converter<String, String> {
|
||||||
buffer.write(!close ? '[' : '](${attribute.value})');
|
buffer.write(!close ? '[' : '](${attribute.value})');
|
||||||
} else if (attribute == Attribute.codeBlock) {
|
} else if (attribute == Attribute.codeBlock) {
|
||||||
buffer.write(!close ? '```\n' : '\n```');
|
buffer.write(!close ? '```\n' : '\n```');
|
||||||
|
} else if (attribute.key == Attribute.background.key) {
|
||||||
|
buffer.write(!close ? '<mark>' : '</mark>');
|
||||||
|
} else if (attribute.key == Attribute.underline.key) {
|
||||||
|
buffer.write(!close ? '<u>' : '</u>');
|
||||||
|
} else if (attribute.key == Attribute.codeBlock.key) {
|
||||||
|
buffer.write(!close ? '```\n' : '\n```');
|
||||||
|
} else if (attribute.key == Attribute.inlineCode.key) {
|
||||||
|
buffer.write(!close ? '`' : '`');
|
||||||
|
} else if (attribute.key == Attribute.strikeThrough.key) {
|
||||||
|
buffer.write(!close ? '~~' : '~~');
|
||||||
} else {
|
} else {
|
||||||
throw ArgumentError('Cannot handle $attribute');
|
throw ArgumentError('Cannot handle $attribute');
|
||||||
}
|
}
|
||||||
|
@ -246,6 +253,8 @@ class DeltaMarkdownEncoder extends Converter<String, String> {
|
||||||
buffer.write('## ');
|
buffer.write('## ');
|
||||||
} else if (block.key == Attribute.h3.key && block.value == 3) {
|
} else if (block.key == Attribute.h3.key && block.value == 3) {
|
||||||
buffer.write('### ');
|
buffer.write('### ');
|
||||||
|
} else if (block.key == Attribute.list.key) {
|
||||||
|
buffer.write('* ');
|
||||||
} else {
|
} else {
|
||||||
throw ArgumentError('Cannot handle block $block');
|
throw ArgumentError('Cannot handle block $block');
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,10 +128,10 @@ class _FlowyColorButtonState extends State<FlowyColorButton> {
|
||||||
|
|
||||||
final style = widget.controller.getSelectionStyle();
|
final style = widget.controller.getSelectionStyle();
|
||||||
final values = style.values.where((v) => v.key == Attribute.background.key).map((v) => v.value);
|
final values = style.values.where((v) => v.key == Attribute.background.key).map((v) => v.value);
|
||||||
int initailColor = 0;
|
int initialColor = 0;
|
||||||
if (values.isNotEmpty) {
|
if (values.isNotEmpty) {
|
||||||
assert(values.length == 1);
|
assert(values.length == 1);
|
||||||
initailColor = stringToHex(values.first);
|
initialColor = stringToHex(values.first);
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledDialog(
|
StyledDialog(
|
||||||
|
@ -145,7 +145,7 @@ class _FlowyColorButtonState extends State<FlowyColorButton> {
|
||||||
_changeColor(context, color);
|
_changeColor(context, color);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
initailColor: initailColor,
|
initialColor: initialColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
).show(context);
|
).show(context);
|
||||||
|
@ -168,8 +168,8 @@ class FlowyColorPicker extends StatefulWidget {
|
||||||
0xffdefff1,
|
0xffdefff1,
|
||||||
];
|
];
|
||||||
final Function(Color?) onColorChanged;
|
final Function(Color?) onColorChanged;
|
||||||
final int initailColor;
|
final int initialColor;
|
||||||
FlowyColorPicker({Key? key, required this.onColorChanged, this.initailColor = 0}) : super(key: key);
|
FlowyColorPicker({Key? key, required this.onColorChanged, this.initialColor = 0}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<FlowyColorPicker> createState() => _FlowyColorPickerState();
|
State<FlowyColorPicker> createState() => _FlowyColorPickerState();
|
||||||
|
@ -207,7 +207,7 @@ class _FlowyColorPickerState extends State<FlowyColorPicker> {
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(BuildContext context, int index) {
|
(BuildContext context, int index) {
|
||||||
if (widget.colors.length > index) {
|
if (widget.colors.length > index) {
|
||||||
final isSelected = widget.colors[index] == widget.initailColor;
|
final isSelected = widget.colors[index] == widget.initialColor;
|
||||||
return ColorItem(
|
return ColorItem(
|
||||||
color: Color(widget.colors[index]),
|
color: Color(widget.colors[index]),
|
||||||
onPressed: widget.onColorChanged,
|
onPressed: widget.onColorChanged,
|
||||||
|
|
|
@ -109,7 +109,7 @@ fn gen_token_stream(ctxt: &Ctxt, member: &syn::Member, ty: &syn::Type, is_option
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// e.g. pub cells: Vec<CellData>, the memeber will be cells, ty would be Vec
|
// e.g. pub cells: Vec<CellData>, the member will be cells, ty would be Vec
|
||||||
fn token_stream_for_vec(ctxt: &Ctxt, member: &syn::Member, ty: &syn::Type) -> Option<TokenStream> {
|
fn token_stream_for_vec(ctxt: &Ctxt, member: &syn::Member, ty: &syn::Type) -> Option<TokenStream> {
|
||||||
let ty_info = parse_ty(ctxt, ty)?;
|
let ty_info = parse_ty(ctxt, ty)?;
|
||||||
match ident_category(ty_info.ident) {
|
match ident_category(ty_info.ident) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue