Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
21cf5d1
WIP: Hack table support (Resolves #2746)
matthew-carroll Jul 27, 2025
22647b1
WIP: Hacking components within components
matthew-carroll Aug 26, 2025
0607752
WIP: Components in components
matthew-carroll Sep 21, 2025
6cb46b2
Add ImeNodeSerialization that Nodes can implement to provide custom I…
alexgarbarev Nov 9, 2025
d6f15a3
WIP: Fixed column_component child component node ids, and implemented…
alexgarbarev Nov 11, 2025
d7680fa
WIP: Selection and highlighting within CompositeNodeViewModel/Composi…
alexgarbarev Nov 11, 2025
17b4d37
WIP: Text insertion inside composite nodes - initial implementation. …
alexgarbarev Nov 11, 2025
737112f
Merge branch 'main' into aleksey/2746_hack-tables-into-existing-doc-s…
alexgarbarev Nov 13, 2025
1654c29
WIP delete text by backspace inside composite node is done
alexgarbarev Nov 13, 2025
a6430c3
WIP delete text by 'delete' inside composite node is done
alexgarbarev Nov 13, 2025
9bbe078
WIP delete selection within CompositeNode. Also select word/paragraph…
alexgarbarev Nov 13, 2025
8691e0c
WIP copy-paste and history support for leaf TextNodes
alexgarbarev Nov 13, 2025
1ae97e6
WIP updated example with nested banners. Fixed bug in copyAndReplaceL…
alexgarbarev Nov 14, 2025
4b25254
WIP Introduced NodePath to have unique address of each node in hierar…
alexgarbarev Nov 14, 2025
bddc428
WIP logs commented out
alexgarbarev Nov 14, 2025
a84cfbd
WIP refactoring for document updating by NodePath. HR reaction update…
alexgarbarev Nov 15, 2025
cca0818
WIP NodePath refactoring. _LeafNodeIterator introduced together with …
alexgarbarev Nov 15, 2025
50eee05
WIP Styler updated to fully support CompositeNodes (parent, next and …
alexgarbarev Nov 15, 2025
7035526
WIP Content deletion mostly done within NodePath (CompositeNode)
alexgarbarev Nov 15, 2025
7d42a6c
WIP Reverted most of changes related to NodePath. Starting a new appr…
alexgarbarev Nov 19, 2025
4e0c061
WIP Continued with another approach, reverted some previous changes.
alexgarbarev Nov 20, 2025
61c31e6
WIP Bug fixes related to content deletion within multiple composite n…
alexgarbarev Nov 20, 2025
f02342c
WIP Working on Table demo implementation
alexgarbarev Nov 21, 2025
e33b7e5
WIP Working on Table demo, working on custom selection flow
alexgarbarev Nov 23, 2025
7e609d4
WIP Working on Table selection. Finished "getNodesInside" and "refine…
alexgarbarev Nov 25, 2025
e5f8671
WIP editor/document files cleanup, removing unused methods
alexgarbarev Nov 25, 2025
1005b18
WIP bug fixing for selection deletion inside composite nodes
alexgarbarev Nov 25, 2025
630ebee
WIP bug fixing for content deletion within CompositeNode (upstream, d…
alexgarbarev Nov 26, 2025
823fcf4
WIP fixed issue when child components was re-created on every build d…
alexgarbarev Nov 26, 2025
909a1f1
WIP fixed issue when table was not deleted when fully selected.
alexgarbarev Nov 27, 2025
0f78886
WIP fixed cases when expanded selection and deletion could be through…
alexgarbarev Nov 28, 2025
966704f
WIP IME serialization reverted. Unused code cleanup. Bug fixing for n…
alexgarbarev Nov 28, 2025
4f281e3
Merge branch 'main' into aleksey/2746_hack-tables-into-existing-doc-s…
alexgarbarev Nov 28, 2025
7a5f750
WIP Demo table now supports selection by cells/rows with keyboard sho…
alexgarbarev Nov 28, 2025
de5845c
Copy text content implemented for CompositeNodes. Removed duplicated …
alexgarbarev Nov 28, 2025
7c7743e
Broken test fixed. Demo table: hide text selection inside cells
alexgarbarev Nov 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions super_editor/.run/Demo_ Components in Components.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Demo: Components in Components" type="FlutterRunConfigurationType" factoryName="Flutter">
<option name="filePath" value="$PROJECT_DIR$/example/lib/main_components_in_components.dart" />
<method v="2" />
</configuration>
</component>
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ class HeaderWithHintComponentBuilder implements ComponentBuilder {
const HeaderWithHintComponentBuilder();

@override
SingleColumnLayoutComponentViewModel? createViewModel(Document document, DocumentNode node) {
SingleColumnLayoutComponentViewModel? createViewModel(
PresenterContext context,
Document document,
DocumentNode node,
) {
// This component builder can work with the standard paragraph view model.
// We'll defer to the standard paragraph component builder to create it.
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ class UnselectableHrComponentBuilder implements ComponentBuilder {
const UnselectableHrComponentBuilder();

@override
SingleColumnLayoutComponentViewModel? createViewModel(Document document, DocumentNode node) {
SingleColumnLayoutComponentViewModel? createViewModel(
PresenterContext context,
Document document,
DocumentNode node,
) {
// This builder can work with the standard horizontal rule view model, so
// we'll defer to the standard horizontal rule builder.
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ class AnimatedTaskComponentBuilder implements ComponentBuilder {
const AnimatedTaskComponentBuilder();

@override
SingleColumnLayoutComponentViewModel? createViewModel(Document document, DocumentNode node) {
SingleColumnLayoutComponentViewModel? createViewModel(
PresenterContext context,
Document document,
DocumentNode node,
) {
// This builder can work with the standard task view model, so
// we'll defer to the standard task builder.
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,13 @@ class SpellingErrorParagraphComponentBuilder implements ComponentBuilder {
final UnderlineStyle underlineStyle;

@override
SingleColumnLayoutComponentViewModel? createViewModel(Document document, DocumentNode node) {
final viewModel = ParagraphComponentBuilder().createViewModel(document, node) as ParagraphComponentViewModel?;
SingleColumnLayoutComponentViewModel? createViewModel(
PresenterContext context,
Document document,
DocumentNode node,
) {
final viewModel =
ParagraphComponentBuilder().createViewModel(context, document, node) as ParagraphComponentViewModel?;
if (viewModel == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class _SuperReaderDemoState extends State<SuperReaderDemo> {
return;
}

final textToCopy = _textInSelection(
final textToCopy = extractTextFromSelection(
document: _editor.document,
documentSelection: _editor.composer.selection!,
);
Expand All @@ -54,62 +54,6 @@ class _SuperReaderDemoState extends State<SuperReaderDemo> {
_saveToClipboard(textToCopy);
}

String _textInSelection({
required Document document,
required DocumentSelection documentSelection,
}) {
final selectedNodes = document.getNodesInside(
documentSelection.base,
documentSelection.extent,
);

final buffer = StringBuffer();
for (int i = 0; i < selectedNodes.length; ++i) {
final selectedNode = selectedNodes[i];
dynamic nodeSelection;

if (i == 0) {
// This is the first node and it may be partially selected.
final baseSelectionPosition = selectedNode.id == documentSelection.base.nodeId
? documentSelection.base.nodePosition
: documentSelection.extent.nodePosition;

final extentSelectionPosition =
selectedNodes.length > 1 ? selectedNode.endPosition : documentSelection.extent.nodePosition;

nodeSelection = selectedNode.computeSelection(
base: baseSelectionPosition,
extent: extentSelectionPosition,
);
} else if (i == selectedNodes.length - 1) {
// This is the last node and it may be partially selected.
final nodePosition = selectedNode.id == documentSelection.base.nodeId
? documentSelection.base.nodePosition
: documentSelection.extent.nodePosition;

nodeSelection = selectedNode.computeSelection(
base: selectedNode.beginningPosition,
extent: nodePosition,
);
} else {
// This node is fully selected. Copy the whole thing.
nodeSelection = selectedNode.computeSelection(
base: selectedNode.beginningPosition,
extent: selectedNode.endPosition,
);
}

final nodeContent = selectedNode.copyContent(nodeSelection);
if (nodeContent != null) {
buffer.write(nodeContent);
if (i < selectedNodes.length - 1) {
buffer.writeln();
}
}
}
return buffer.toString();
}

Future<void> _saveToClipboard(String text) {
return Clipboard.setData(ClipboardData(text: text));
}
Expand Down
Loading