dartlangeditorflutterflutter-appsflutter-examplesflutter-packageflutter-widgetquillquill-deltaquilljsreactquillrich-textrich-text-editorwysiwygwysiwyg-editor
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
718 B
42 lines
718 B
import 'package:quill_delta/quill_delta.dart'; |
|
|
|
import 'node.dart'; |
|
|
|
/* A leaf node in document tree */ |
|
abstract class Leaf extends Node { |
|
Object _value; |
|
|
|
Object get value => _value; |
|
|
|
Leaf.val(Object val) |
|
: assert(val != null), |
|
_value = val; |
|
|
|
@override |
|
int get length { |
|
if (_value is String) { |
|
return (_value as String).length; |
|
} |
|
// return 1 for embedded object |
|
return 1; |
|
} |
|
|
|
@override |
|
Delta toDelta() { |
|
return null; // TODO |
|
} |
|
} |
|
|
|
class Text extends Leaf { |
|
Text([String text = '']) |
|
: assert(!text.contains('\n')), |
|
super.val(text); |
|
|
|
@override |
|
String get value => _value as String; |
|
|
|
@override |
|
String toPlainText() { |
|
return value; |
|
} |
|
}
|
|
|