瀏覽代碼

Fixed analysis warnings, added example

Anatoly Pulyaevskiy 6 年之前
父節點
當前提交
8598fb560c
共有 3 個文件被更改,包括 37 次插入3 次删除
  1. 6
    0
      packages/notus/CHANGELOG.md
  2. 27
    0
      packages/notus/example/main.dart
  3. 4
    3
      packages/notus/pubspec.yaml

+ 6
- 0
packages/notus/CHANGELOG.md 查看文件

@@ -1,3 +1,9 @@
1
+## 0.1.1
2
+
3
+* Added `meta` package to dependencies.
4
+* Fixed analysis warnings.
5
+* Added example.
6
+
1 7
 ## 0.1.0
2 8
 
3 9
 *  Initial release.

+ 27
- 0
packages/notus/example/main.dart 查看文件

@@ -0,0 +1,27 @@
1
+// Copyright (c) 2018, the Zefyr project authors.  Please see the AUTHORS file
2
+// for details. All rights reserved. Use of this source code is governed by a
3
+// BSD-style license that can be found in the LICENSE file.
4
+
5
+import 'package:notus/notus.dart';
6
+
7
+void main() {
8
+  final doc = new NotusDocument();
9
+  // Modify this document with insert, delete and format operations
10
+  doc.insert(
11
+      0, 'Notus package provides rich text document model for Zefyr editor');
12
+  doc.format(0, 5, NotusAttribute.bold); // Makes first word bold.
13
+  doc.format(0, 0, NotusAttribute.h1); // Makes first line a heading.
14
+  doc.delete(23, 10); // Deletes "rich text " segment.
15
+
16
+  // Collects style attributes at 1 character in this document.
17
+  doc.collectStyle(1, 0); // returned style would include "bold" and "h1".
18
+
19
+  // Listen to all changes applied to this document.
20
+  doc.changes.listen((change){
21
+    print(change);
22
+  });
23
+
24
+  // Dispose resources allocated by this document, e.g. closes "changes" stream.
25
+  // After document is closed it cannot be modified.
26
+  doc.close();
27
+}

+ 4
- 3
packages/notus/pubspec.yaml 查看文件

@@ -1,14 +1,15 @@
1 1
 name: notus
2
-description: Rich text document model for Zefyr editor.
3
-version: 0.1.0
2
+description: Platform-agnostic rich text document model based on Delta format and used in Zefyr editor.
3
+version: 0.1.1
4 4
 author: Anatoly Pulyaevskiy <anatoly.pulyaevskiy@gmail.com>
5 5
 homepage: https://github.com/memspace/zefyr
6 6
 
7 7
 environment:
8
-  sdk: '>=2.0.0-dev.58.0 <2.0.0'
8
+  sdk: '>=2.0.0-dev.58.0 <3.0.0'
9 9
 
10 10
 dependencies:
11 11
   collection: ^1.14.6
12
+  meta: ^1.1.6
12 13
   quill_delta: ^1.0.0-dev
13 14
   quiver_hashcode: ^1.0.0
14 15