| 
				
			 | 
			
			
				@@ -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
			 | 
			
			
				+} 
			 |