fix: align the namespace and toggle shortcuts (#6726)

* chore: update translations, url to URL

* fix: children disapper when using toggle shortcuts

* fix: add tooltip for namespace button

* test: add toggle shortcut test
This commit is contained in:
Lucas 2024-11-06 09:08:59 +08:00 committed by GitHub
parent 0a1af4e61f
commit fe4f85a597
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 64 additions and 24 deletions

View File

@ -67,6 +67,7 @@ Future<void> _formatGreaterToToggleHeading(
node.path,
toggleListBlockNode(
delta: delta,
children: node.children.map((e) => e.copyWith()).toList(),
),
)
..deleteNode(node);

View File

@ -42,11 +42,7 @@ class DomainItem extends StatelessWidget {
),
// Homepage
Expanded(
child: Padding(
padding: const EdgeInsets.only(
left: SettingsPageSitesConstants.alignPadding,),
child: _buildHomepage(context),
),
child: _buildHomepage(context),
),
// ... button
DomainMoreAction(namespace: namespace),
@ -58,20 +54,23 @@ class DomainItem extends StatelessWidget {
return Container(
alignment: Alignment.centerLeft,
padding: const EdgeInsets.only(right: 12.0),
child: FlowyButton(
useIntrinsicWidth: true,
text: FlowyText(
namespaceUrl,
fontSize: 14.0,
overflow: TextOverflow.ellipsis,
child: FlowyTooltip(
message: '${LocaleKeys.shareAction_visitSite.tr()}\n$namespaceUrl',
child: FlowyButton(
useIntrinsicWidth: true,
text: FlowyText(
namespaceUrl,
fontSize: 14.0,
overflow: TextOverflow.ellipsis,
),
onTap: () {
final namespaceUrl = ShareConstants.buildNamespaceUrl(
nameSpace: namespace,
withHttps: true,
);
afLaunchUrlString(namespaceUrl);
},
),
onTap: () {
final namespaceUrl = ShareConstants.buildNamespaceUrl(
nameSpace: namespace,
withHttps: true,
);
afLaunchUrlString(namespaceUrl);
},
),
);
}
@ -85,7 +84,12 @@ class DomainItem extends StatelessWidget {
final isFreePlan = plan == WorkspacePlanPB.FreePlan;
if (isFreePlan) {
return const _FreePlanUpgradeButton();
return const Padding(
padding: EdgeInsets.only(
left: SettingsPageSitesConstants.alignPadding,
),
child: _FreePlanUpgradeButton(),
);
}
return const _HomePageButton();
@ -178,7 +182,7 @@ class _HomePageButton extends StatelessWidget {
},
text: const FlowySvg(
FlowySvgs.close_m,
size: Size.square(18.0),
size: Size.square(19.0),
),
),
),

View File

@ -61,8 +61,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: "2903792"
resolved-ref: "2903792fa319e1b4077164eeb684f6e8d1c63e27"
ref: "76daa96"
resolved-ref: "76daa96af51f0ad4e881c10426a91780977544e5"
url: "https://github.com/AppFlowy-IO/appflowy-editor.git"
source: git
version: "4.0.0"

View File

@ -172,7 +172,7 @@ dependency_overrides:
appflowy_editor:
git:
url: https://github.com/AppFlowy-IO/appflowy-editor.git
ref: "2903792"
ref: "76daa96"
appflowy_editor_plugins:
git:

View File

@ -49,5 +49,40 @@ void main() {
editorState.dispose();
});
testWidgets('convert block contains children to toggle list',
(tester) async {
const paragraph1 = '>paragraph 1';
const paragraph1_1 = 'paragraph 1.1';
const paragraph1_2 = 'paragraph 1.2';
final document = createDocument([
paragraphNode(
text: paragraph1,
children: [
paragraphNode(text: paragraph1_1),
paragraphNode(text: paragraph1_2),
],
),
]);
final editorState = EditorState(document: document);
editorState.selection = Selection.collapsed(
Position(path: [0], offset: 1),
);
final result = await formatGreaterToToggleList.execute(editorState);
expect(result, true);
expect(editorState.document.root.children.length, 1);
final node = editorState.document.root.children[0];
expect(node.type, ToggleListBlockKeys.type);
expect(node.delta!.toPlainText(), 'paragraph 1');
expect(node.children.length, 2);
expect(node.children[0].delta!.toPlainText(), paragraph1_1);
expect(node.children[1].delta!.toPlainText(), paragraph1_2);
editorState.dispose();
});
});
}

View File

@ -445,7 +445,7 @@
"removeHomepage": "Remove homepage",
"selectHomePage": "Select a page",
"clearHomePage": "Clear the home page for this namespace",
"customUrl": "Custom url",
"customUrl": "Custom URL",
"namespace": {
"description": "This change will apply to all the published pages live on this namespace",
"tooltip": "We reserve the rights to remove any inappropriate namespaces",