|
@@ -33,11 +33,11 @@ class FullPageEditorScreen extends StatefulWidget {
|
33
|
33
|
|
34
|
34
|
Delta getDelta() {
|
35
|
35
|
final doc =
|
36
|
|
- r'[{"insert":"Zefyr", "attributes": {"color": "#595959"}},{"insert":"\n","attributes":{"heading":1}},{"insert":"Soft and gentle rich text editing for Flutter applications.","attributes":{"i":true}},{"insert":"\n"},{"insert":"","attributes":{"embed":{"type":"image","source":"asset://images/breeze.jpg"}}},{"insert":"\n"},{"insert":"Photo by Hiroyuki Takeda.","attributes":{"i":true}},{"insert":"\nZefyr is currently in "},{"insert":"early preview","attributes":{"b":true}},{"insert":". If you have a feature request or found a bug, please file it at the "},{"insert":"issue tracker","attributes":{"a":"https://github.com/memspace/zefyr/issues"}},{"insert":'
|
37
|
|
- r'".\nDocumentation"},{"insert":"\n","attributes":{"heading":3}},{"insert":"Quick Start","attributes":{"a":"https://github.com/memspace/zefyr/blob/master/doc/quick_start.md"}},{"insert":"\n","attributes":{"block":"ul"}},{"insert":"Data Format and Document Model","attributes":{"a":"https://github.com/memspace/zefyr/blob/master/doc/data_and_document.md"}},{"insert":"\n","attributes":{"block":"ul"}},{"insert":"Style Attributes","attributes":{"a":"https://github.com/memspace/zefyr/blob/master/doc/attr'
|
38
|
|
- r'ibutes.md"}},{"insert":"\n","attributes":{"block":"ul"}},{"insert":"Heuristic Rules","attributes":{"a":"https://github.com/memspace/zefyr/blob/master/doc/heuristics.md"}},{"insert":"\n","attributes":{"block":"ul"}},{"insert":"FAQ","attributes":{"a":"https://github.com/memspace/zefyr/blob/master/doc/faq.md"}},{"insert":"\n","attributes":{"block":"ul"}},{"insert":"Clean and modern look"},{"insert":"\n","attributes":{"heading":2}},{"insert":"Zefyr’s rich text editor is built with simplicity and fle'
|
39
|
|
- r'xibility in mind. It provides clean interface for distraction-free editing. Think Medium.com-like experience.\nMarkdown inspired semantics"},{"insert":"\n","attributes":{"heading":2}},{"insert":"Ever needed to have a heading line inside of a quote block, like this:\nI’m a Markdown heading"},{"insert":"\n","attributes":{"block":"quote","heading":3}},{"insert":"And I’m a regular paragraph"},{"insert":"\n","attributes":{"block":"quote"}},{"insert":"Code blocks"},{"insert":"\n","attributes":{"headin'
|
40
|
|
- r'g":2}},{"insert":"Of course:\nimport ‘package:flutter/material.dart’;"},{"insert":"\n","attributes":{"block":"code"}},{"insert":"import ‘package:zefyr/zefyr.dart’;"},{"insert":"\n\n","attributes":{"block":"code"}},{"insert":"void main() {"},{"insert":"\n","attributes":{"block":"code"}},{"insert":" runApp(MyZefyrApp());"},{"insert":"\n","attributes":{"block":"code"}},{"insert":"}"},{"insert":"\n","attributes":{"block":"code"}},{"insert":"\n\n\n"}]';
|
|
36
|
+ r'[{"insert":"Zefyr", "attributes": {"color": "#595959"}},{"insert":"\n","attributes":{"heading":1}},{"insert":"Soft and gentle rich text editing for Flutter applications.","attributes":{"i":true}},{"insert":"\n"},{"insert":"","attributes":{"embed":{"type":"image","source":"asset://images/breeze.jpg"}}},{"insert":"\n"},{"insert":"Photo by Hiroyuki Takeda.","attributes":{"i":true}},{"insert":"\nZefyr is currently in "},{"insert":"early preview","attributes":{"b":true}},{"insert":". If you have a feature request or found a bug, please file it at the "},{"insert":"issue tracker","attributes":{"a":"https://github.com/memspace/zefyr/issues"}},{"insert":'
|
|
37
|
+ r'".\nDocumentation"},{"insert":"\n","attributes":{"heading":3}},{"insert":"Quick Start","attributes":{"a":"https://github.com/memspace/zefyr/blob/master/doc/quick_start.md"}},{"insert":"\n","attributes":{"block":"ul"}},{"insert":"Data Format and Document Model","attributes":{"a":"https://github.com/memspace/zefyr/blob/master/doc/data_and_document.md"}},{"insert":"\n","attributes":{"block":"ul"}},{"insert":"Style Attributes","attributes":{"a":"https://github.com/memspace/zefyr/blob/master/doc/attr'
|
|
38
|
+ r'ibutes.md"}},{"insert":"\n","attributes":{"block":"ul"}},{"insert":"Heuristic Rules","attributes":{"a":"https://github.com/memspace/zefyr/blob/master/doc/heuristics.md"}},{"insert":"\n","attributes":{"block":"ul"}},{"insert":"FAQ","attributes":{"a":"https://github.com/memspace/zefyr/blob/master/doc/faq.md"}},{"insert":"\n","attributes":{"block":"ul"}},{"insert":"Clean and modern look"},{"insert":"\n","attributes":{"heading":2}},{"insert":"Zefyr’s rich text editor is built with simplicity and fle'
|
|
39
|
+ r'xibility in mind. It provides clean interface for distraction-free editing. Think Medium.com-like experience.\nMarkdown inspired semantics"},{"insert":"\n","attributes":{"heading":2}},{"insert":"Ever needed to have a heading line inside of a quote block, like this:\nI’m a Markdown heading"},{"insert":"\n","attributes":{"block":"quote","heading":3}},{"insert":"And I’m a regular paragraph"},{"insert":"\n","attributes":{"block":"quote"}},{"insert":"Code blocks"},{"insert":"\n","attributes":{"headin'
|
|
40
|
+ r'g":2}},{"insert":"Of course:\nimport ‘package:flutter/material.dart’;"},{"insert":"\n","attributes":{"block":"code"}},{"insert":"import ‘package:zefyr/zefyr.dart’;"},{"insert":"\n\n","attributes":{"block":"code"}},{"insert":"void main() {"},{"insert":"\n","attributes":{"block":"code"}},{"insert":" runApp(MyZefyrApp());"},{"insert":"\n","attributes":{"block":"code"}},{"insert":"}"},{"insert":"\n","attributes":{"block":"code"}},{"insert":"\n\n\n"}]';
|
41
|
41
|
return Delta.fromJson(json.decode(doc) as List);
|
42
|
42
|
}
|
43
|
43
|
|
|
@@ -88,26 +88,26 @@ class _FullPageEditorScreenState extends State<FullPageEditorScreen> {
|
88
|
88
|
body: Column(
|
89
|
89
|
children: <Widget>[
|
90
|
90
|
Container(
|
91
|
|
- height: 50,
|
92
|
|
- child: Row(
|
93
|
|
- children: <Widget>[
|
94
|
|
- Expanded(
|
95
|
|
- child: TextField(
|
96
|
|
- onChanged: (text) {
|
97
|
|
- SearchResultEntity a = _controller.search(text);
|
98
|
|
- setState(() {
|
99
|
|
- _searchResultEntity = a;
|
100
|
|
- });
|
101
|
|
- },
|
|
91
|
+ height: 50,
|
|
92
|
+ child: Row(
|
|
93
|
+ children: <Widget>[
|
|
94
|
+ Expanded(
|
|
95
|
+ child: TextField(
|
|
96
|
+ onChanged: (text) {
|
|
97
|
+ SearchResultEntity a = _controller.search(text);
|
|
98
|
+ setState(() {
|
|
99
|
+ _searchResultEntity = a;
|
|
100
|
+ });
|
|
101
|
+ },
|
|
102
|
+ ),
|
102
|
103
|
),
|
103
|
|
- ),
|
104
|
|
- Container(
|
105
|
|
- padding: EdgeInsets.symmetric(horizontal: 10),
|
106
|
|
- child: Text('${_searchResultEntity.current} / ${_searchResultEntity.total}'),
|
107
|
|
- )
|
108
|
|
- ],
|
109
|
|
- )
|
110
|
|
- ),
|
|
104
|
+ Container(
|
|
105
|
+ padding: EdgeInsets.symmetric(horizontal: 10),
|
|
106
|
+ child: Text(
|
|
107
|
+ '${_searchResultEntity.current} / ${_searchResultEntity.total}'),
|
|
108
|
+ )
|
|
109
|
+ ],
|
|
110
|
+ )),
|
111
|
111
|
Container(
|
112
|
112
|
child: Row(
|
113
|
113
|
children: <Widget>[
|
|
@@ -142,26 +142,24 @@ class _FullPageEditorScreenState extends State<FullPageEditorScreen> {
|
142
|
142
|
),
|
143
|
143
|
),
|
144
|
144
|
Expanded(
|
145
|
|
- child: ZefyrScaffold(
|
146
|
|
- child: ZefyrTheme(
|
147
|
|
- data: ZefyrThemeData(
|
148
|
|
- // attributeTheme: AttributeTheme(
|
149
|
|
- // link: TextStyle(
|
150
|
|
- // color: Colors.red,
|
151
|
|
- // ),
|
152
|
|
- // ),
|
153
|
|
- ),
|
154
|
|
- child: ZefyrEditor(
|
155
|
|
- autofocus: false,
|
156
|
|
- controller: _controller,
|
157
|
|
- focusNode: _focusNode,
|
158
|
|
- mode: ZefyrMode.edit,
|
159
|
|
- imageDelegate: CustomImageDelegate(),
|
160
|
|
- linkDelegate: CustomLinkDelegate(),
|
161
|
|
- keyboardAppearance: _darkTheme ? Brightness.dark : Brightness.light,
|
162
|
|
- ),
|
163
|
|
- ),
|
164
|
|
- ),
|
|
145
|
+ child: ZefyrScaffold(
|
|
146
|
+ child: ZefyrTheme(
|
|
147
|
+ data: ZefyrThemeData(),
|
|
148
|
+ child: ZefyrEditor(
|
|
149
|
+ autofocus: false,
|
|
150
|
+ controller: _controller,
|
|
151
|
+ focusNode: _focusNode,
|
|
152
|
+ mode: ZefyrMode.edit,
|
|
153
|
+ imageDelegate: CustomImageDelegate(),
|
|
154
|
+ linkDelegate: CustomLinkDelegate(),
|
|
155
|
+ keyboardAppearance:
|
|
156
|
+ _darkTheme ? Brightness.dark : Brightness.light,
|
|
157
|
+ onSave: () {
|
|
158
|
+ print(_controller.document.toJson());
|
|
159
|
+ },
|
|
160
|
+ ),
|
|
161
|
+ ),
|
|
162
|
+ ),
|
165
|
163
|
),
|
166
|
164
|
],
|
167
|
165
|
),
|