From 8cd7f979171643403e18b297e3614802fd59d7f3 Mon Sep 17 00:00:00 2001 From: Shams Zakhour Date: Sun, 9 Oct 2016 08:45:56 -0700 Subject: [PATCH 01/22] Adding examples for the Developer Workflow code lab. --- dev-workflow/base | 1 + dev-workflow/final | 1 + 2 files changed, 2 insertions(+) create mode 160000 dev-workflow/base create mode 160000 dev-workflow/final diff --git a/dev-workflow/base b/dev-workflow/base new file mode 160000 index 0000000..9ef2b04 --- /dev/null +++ b/dev-workflow/base @@ -0,0 +1 @@ +Subproject commit 9ef2b0471418ea16e0dec3e7c254cdb9b6496d83 diff --git a/dev-workflow/final b/dev-workflow/final new file mode 160000 index 0000000..9ef2b04 --- /dev/null +++ b/dev-workflow/final @@ -0,0 +1 @@ +Subproject commit 9ef2b0471418ea16e0dec3e7c254cdb9b6496d83 From cb0d9e526e25ed995850fda6a24010c725bdb0ef Mon Sep 17 00:00:00 2001 From: Shams Zakhour Date: Sun, 9 Oct 2016 11:03:57 -0700 Subject: [PATCH 02/22] Removing some temporary code. --- dev-workflow/1-base/.analysis_options | 14 ++++ dev-workflow/1-base/.gitignore | 22 +++++ dev-workflow/1-base/pubspec.yaml | 14 ++++ dev-workflow/1-base/web/index.html | 33 ++++++++ dev-workflow/1-base/web/main.dart | 112 ++++++++++++++++++++++++++ dev-workflow/1-base/web/styles.css | 103 +++++++++++++++++++++++ 6 files changed, 298 insertions(+) create mode 100644 dev-workflow/1-base/.analysis_options create mode 100644 dev-workflow/1-base/.gitignore create mode 100644 dev-workflow/1-base/pubspec.yaml create mode 100644 dev-workflow/1-base/web/index.html create mode 100644 dev-workflow/1-base/web/main.dart create mode 100644 dev-workflow/1-base/web/styles.css diff --git a/dev-workflow/1-base/.analysis_options b/dev-workflow/1-base/.analysis_options new file mode 100644 index 0000000..0a8c163 --- /dev/null +++ b/dev-workflow/1-base/.analysis_options @@ -0,0 +1,14 @@ +# This file allows you to configure the Dart analyzer. +# +# The commented part below is just for inspiration. Read the guide here: +# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer + +# analyzer: +# strong-mode: true +# exclude: +# - path/to/excluded/files/** +# linter: +# rules: +# # see catalogue here: http://dart-lang.github.io/linter/lints/ +# - hash_and_equals + diff --git a/dev-workflow/1-base/.gitignore b/dev-workflow/1-base/.gitignore new file mode 100644 index 0000000..04d4ee3 --- /dev/null +++ b/dev-workflow/1-base/.gitignore @@ -0,0 +1,22 @@ +pubspec.lock +.buildlog +.packages +.project +.pub/ + +build/ +**/packages/ +web/gen +web/packages + +doc/api/ + +*.iml +*.ipr +*.iws +.idea/ +.DS_Store + +*.dart.js +*.info.json +*.js diff --git a/dev-workflow/1-base/pubspec.yaml b/dev-workflow/1-base/pubspec.yaml new file mode 100644 index 0000000..38ed882 --- /dev/null +++ b/dev-workflow/1-base/pubspec.yaml @@ -0,0 +1,14 @@ +name: captains_log +version: 0.0.1 +description: > + A starship captain's log with a WYSIWYG editor. Uses an existing JavaScript + library with the new Dart JS-interop. + +environment: + sdk: '>=1.17.0 <2.0.0' + +dependencies: + func: ^0.1.0 + js: ^0.6.1 + browser: any + html: any \ No newline at end of file diff --git a/dev-workflow/1-base/web/index.html b/dev-workflow/1-base/web/index.html new file mode 100644 index 0000000..435587b --- /dev/null +++ b/dev-workflow/1-base/web/index.html @@ -0,0 +1,33 @@ + + + + Captain's Log + + + + + + +
+

Captain's Log

+
+
+
+ +
+ +
+
+
+ + + + diff --git a/dev-workflow/1-base/web/main.dart b/dev-workflow/1-base/web/main.dart new file mode 100644 index 0000000..1d33174 --- /dev/null +++ b/dev-workflow/1-base/web/main.dart @@ -0,0 +1,112 @@ +import 'dart:html'; + +// ignoring leap years +const int _secondsInAYear = 31536000; +const String _prompt = 'Something happened. Make it sound puzzling and heroic.'; +final List _templates = [ + 'We encountered what appeared to be a . It has ' + 'proven to be sentient and has taken control of our ship. Thus far, all ' + 'efforts at communication have failed...', + 'A warship from the has entered our ' + 'territory. It is currently speeding towards Earth. Thus far, all ' + 'efforts at peace have failed...', + 'The ship has been pulled into a . We are ' + 'observing the universe in the distant . Thus far, all ' + 'efforts to return to our timeline have failed...' +]; + +Map logEntries; +HtmlElement logElement; + +main() { + // initialization + logElement = document.getElementById('log'); + logEntries = new Map(); + loadPreviousEntries(); + + // listeners + document.getElementById('save').onClick.listen(saveLog); + document.getElementById('templateSelect') as SelectElement + ..onChange.listen(useTemplate); +} + +/// Capture entry in editor, save to local storage and display in log. +void appendToLog(double stardate, HtmlElement logEntryElement) { + logEntries[stardate] = logEntryElement; + window.localStorage[stardate.toString()] = logEntryElement.innerHtml; + displayLogEntry(stardate, logEntryElement); +} + +/// Calculate the current stardate: . +double calculateStardate() { + var now = new DateTime.now(); + var beginningOfYear = new DateTime(now.year); + int secondsThisYear = now.difference(beginningOfYear).inSeconds; + return now.year + secondsThisYear / _secondsInAYear; +} + +/// Copy html elements from the editor view and return them inside a new +/// DivElement. +HtmlElement captureEditorView() { + Element contentElement = document.getElementById('editor').firstChild; + + var logEntryElement = new DivElement() + ..innerHtml = contentElement.innerHtml; + + return logEntryElement; +} + +void displayLogEntry(double stardate, HtmlElement logEntryElement) { +// var logElement = document.getElementById('log'); + + if (logElement.children.isNotEmpty) { + logElement.insertAdjacentElement('afterBegin', new HRElement()); + } + + logElement.insertAdjacentElement('afterBegin', logEntryElement); + var stardateElement = new HeadingElement.h2() + ..text = 'Stardate: $stardate' + ..classes.add('stardate'); + logElement.insertAdjacentElement('afterBegin', stardateElement); +} + +/// Load all log entries from browser local storage. +void loadPreviousEntries() { +// Element logElement = document.getElementById('log'); + logElement.innerHtml = window.localStorage['log'] ?? ''; + + List keys = window.localStorage.keys.toList(); + keys.sort(); + for (String key in keys) { + var entryElement = new DivElement() + ..innerHtml = window.localStorage[key]; + logEntries[double.parse(key)] = entryElement; + } + updateDisplay(); +} + +/// Save the log entry that is currently in the editor. +void saveLog(Event _) { + DivElement logEntryElement = captureEditorView(); + appendToLog(calculateStardate(), logEntryElement); +} + +void updateDisplay() { + logElement.innerHtml = ''; + List keys = logEntries.keys.toList(); + keys.sort(); + for (double key in keys) { + displayLogEntry(key, logEntries[key]); + } +} + +/// Updates the content of the editor using the selected template. +void useTemplate(Event _) { + SelectElement templateSelectElement = + document.getElementById('templateSelect'); + int selectedIndex = templateSelectElement.selectedIndex; + + if (selectedIndex == 0) return; + + String templateText = _templates[templateSelectElement.selectedIndex - 1]; +} diff --git a/dev-workflow/1-base/web/styles.css b/dev-workflow/1-base/web/styles.css new file mode 100644 index 0000000..49e1612 --- /dev/null +++ b/dev-workflow/1-base/web/styles.css @@ -0,0 +1,103 @@ +body { + padding: 0em; + margin: 0em; +} + +html { + background: #222; + color: white; + font-family: 'Jura', sans-serif; +} + +h1.title { + font-family: 'Orbitron', sans-serif; + font-size: 4em; + margin-top: 0px; + padding: 0.67em; +} + +h2.stardate { + font-family: 'Bungee Hairline', cursive; +} + +.buttons { + display: flex; + justify-content: space-between; + align-items: center; +} + +select { + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; + background-color: #222; + border: none; + color: inherit; + font-size: inherit; + padding: 5px; + padding-right: 18px; +} + +select:focus { + outline: none; +} + +select:active { + background-color: #222; +} + +div.select { + border-bottom: 1px solid gray; + display: inline-block; + height: 100%; + position: relative; +} + +div.select::after { + font-family: 'Material Icons'; + content: '\E5C5'; + position: absolute; + right: 2px; + top: 6px; + pointer-events: none; +} + +button { + background-color: #06c; + border-color: #06c; + border-radius: 5px; + font-family: inherit; + font-size: 1.1em; + margin: 5px; + padding: 20px; +} + +#editor .ql-editor.ql-blank::before { + color: white; +} + +.ql-toolbar .ql-stroke { + stroke: white; +} + +.ql-toolbar .ql-fill { + fill: white; +} + +.ql-toolbar.ql-snow .ql-picker-label { + color: white; +} + +#content { + margin-left: 20%; + margin-right: 20%; + padding-left: 2%; + padding-right: 2%; + background: rgba(22, 22, 22, 0.8); + background-clip: padding-box; +} + +#editor { + height: 20em; + font-size: 1.1em; +} From 0f1f6b393bff13e70097c6f783dedde477e21b3d Mon Sep 17 00:00:00 2001 From: Shams Zakhour Date: Sun, 9 Oct 2016 11:06:08 -0700 Subject: [PATCH 03/22] Tweaking... --- dev-workflow/3-final/.analysis_options | 14 +++ dev-workflow/3-final/.gitignore | 22 ++++ dev-workflow/3-final/README.md | 2 + dev-workflow/3-final/pubspec.yaml | 14 +++ dev-workflow/3-final/web/index.html | 35 ++++++ dev-workflow/3-final/web/main.dart | 122 ++++++++++++++++++ dev-workflow/3-final/web/quill.dart | 168 +++++++++++++++++++++++++ dev-workflow/3-final/web/styles.css | 103 +++++++++++++++ dev-workflow/base | 1 - dev-workflow/final | 1 - 10 files changed, 480 insertions(+), 2 deletions(-) create mode 100644 dev-workflow/3-final/.analysis_options create mode 100644 dev-workflow/3-final/.gitignore create mode 100644 dev-workflow/3-final/README.md create mode 100644 dev-workflow/3-final/pubspec.yaml create mode 100644 dev-workflow/3-final/web/index.html create mode 100644 dev-workflow/3-final/web/main.dart create mode 100644 dev-workflow/3-final/web/quill.dart create mode 100644 dev-workflow/3-final/web/styles.css delete mode 160000 dev-workflow/base delete mode 160000 dev-workflow/final diff --git a/dev-workflow/3-final/.analysis_options b/dev-workflow/3-final/.analysis_options new file mode 100644 index 0000000..6237a10 --- /dev/null +++ b/dev-workflow/3-final/.analysis_options @@ -0,0 +1,14 @@ +# This file allows you to configure the Dart analyzer. +# +# The commented part below is just for inspiration. Read the guide here: +# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer + + analyzer: + strong-mode: true + exclude: + - web/quill.dart +# linter: +# rules: +# # see catalogue here: http://dart-lang.github.io/linter/lints/ +# - hash_and_equals + diff --git a/dev-workflow/3-final/.gitignore b/dev-workflow/3-final/.gitignore new file mode 100644 index 0000000..04d4ee3 --- /dev/null +++ b/dev-workflow/3-final/.gitignore @@ -0,0 +1,22 @@ +pubspec.lock +.buildlog +.packages +.project +.pub/ + +build/ +**/packages/ +web/gen +web/packages + +doc/api/ + +*.iml +*.ipr +*.iws +.idea/ +.DS_Store + +*.dart.js +*.info.json +*.js diff --git a/dev-workflow/3-final/README.md b/dev-workflow/3-final/README.md new file mode 100644 index 0000000..a87044a --- /dev/null +++ b/dev-workflow/3-final/README.md @@ -0,0 +1,2 @@ +# dart-jsinterop-quill +Testing Dart JS-interop with quilljs diff --git a/dev-workflow/3-final/pubspec.yaml b/dev-workflow/3-final/pubspec.yaml new file mode 100644 index 0000000..38ed882 --- /dev/null +++ b/dev-workflow/3-final/pubspec.yaml @@ -0,0 +1,14 @@ +name: captains_log +version: 0.0.1 +description: > + A starship captain's log with a WYSIWYG editor. Uses an existing JavaScript + library with the new Dart JS-interop. + +environment: + sdk: '>=1.17.0 <2.0.0' + +dependencies: + func: ^0.1.0 + js: ^0.6.1 + browser: any + html: any \ No newline at end of file diff --git a/dev-workflow/3-final/web/index.html b/dev-workflow/3-final/web/index.html new file mode 100644 index 0000000..2e5ed88 --- /dev/null +++ b/dev-workflow/3-final/web/index.html @@ -0,0 +1,35 @@ + + + + Captain's Log + + + + + + + +
+

Captain's Log

+
+
+
+ +
+ +
+
+
+ + + + + diff --git a/dev-workflow/3-final/web/main.dart b/dev-workflow/3-final/web/main.dart new file mode 100644 index 0000000..8c02a72 --- /dev/null +++ b/dev-workflow/3-final/web/main.dart @@ -0,0 +1,122 @@ +import 'dart:html'; + +import 'quill.dart' as quill; + +// ignoring leap years +const int _secondsInAYear = 31536000; +const String _prompt = 'Something happened. Make it sound puzzling and heroic.'; +final List _templates = [ + 'We encountered what appeared to be a . It has ' + 'proven to be sentient and has taken control of our ship. Thus far, all ' + 'efforts at communication have failed...', + 'A warship from the has entered our ' + 'territory. It is currently speeding towards Earth. Thus far, all ' + 'efforts at peace have failed...', + 'The ship has been pulled into a . We are ' + 'observing the universe in the distant . Thus far, all ' + 'efforts to return to our timeline have failed...' +]; + +quill.QuillStatic quillEditor; +Map logEntries; +HtmlElement logElement; + +main() { + // initialization + quillEditor = new quill.QuillStatic('#editor', + new quill.QuillOptionsStatic(theme: 'snow', placeholder: _prompt)); + logElement = document.getElementById('log'); + logEntries = new Map(); + loadPreviousEntries(); + + // listeners + document.getElementById('save').onClick.listen(saveLog); + document.getElementById('templateSelect') as SelectElement + ..onChange.listen(useTemplate); +} + +/// Capture entry in editor, save to local storage and display in log. +void appendToLog(double stardate, HtmlElement logEntryElement) { + logEntries[stardate] = logEntryElement; + window.localStorage[stardate.toString()] = logEntryElement.innerHtml; + displayLogEntry(stardate, logEntryElement); +} + +/// Calculate the current stardate: . +double calculateStardate() { + var now = new DateTime.now(); + var beginningOfYear = new DateTime(now.year); + int secondsThisYear = now.difference(beginningOfYear).inSeconds; + return now.year + secondsThisYear / _secondsInAYear; +} + +/// Copy html elements from the editor view and return them inside a new +/// DivElement. +HtmlElement captureEditorView() { + Element contentElement = document.getElementById('editor').firstChild; + + var logEntryElement = new DivElement() + ..innerHtml = contentElement.innerHtml; + + return logEntryElement; +} + +void displayLogEntry(double stardate, HtmlElement logEntryElement) { +// var logElement = document.getElementById('log'); + + if (logElement.children.isNotEmpty) { + logElement.insertAdjacentElement('afterBegin', new HRElement()); + } + + logElement.insertAdjacentElement('afterBegin', logEntryElement); + var stardateElement = new HeadingElement.h2() + ..text = 'Stardate: $stardate' + ..classes.add('stardate'); + logElement.insertAdjacentElement('afterBegin', stardateElement); +} + +/// Load all log entries from browser local storage. +void loadPreviousEntries() { +// Element logElement = document.getElementById('log'); + logElement.innerHtml = window.localStorage['log'] ?? ''; + + List keys = window.localStorage.keys.toList(); + keys.sort(); + for (String key in keys) { + var entryElement = new DivElement() + ..innerHtml = window.localStorage[key]; + logEntries[double.parse(key)] = entryElement; + } + updateDisplay(); +} + +/// Save the log entry that is currently in the editor. +void saveLog(Event _) { + DivElement logEntryElement = captureEditorView(); + appendToLog(calculateStardate(), logEntryElement); + + // Clear the editor. + quillEditor.deleteText(0, quillEditor.getLength()); +} + +void updateDisplay() { + logElement.innerHtml = ''; + List keys = logEntries.keys.toList(); + keys.sort(); + for (double key in keys) { + displayLogEntry(key, logEntries[key]); + } +} + +/// Updates the content of the editor using the selected template. +void useTemplate(Event _) { + SelectElement templateSelectElement = + document.getElementById('templateSelect'); + int selectedIndex = templateSelectElement.selectedIndex; + + if (selectedIndex == 0) return; + + quillEditor.deleteText(0, quillEditor.getLength()); + String templateText = _templates[templateSelectElement.selectedIndex - 1]; + quillEditor.insertText(0, templateText, 'api'); +} \ No newline at end of file diff --git a/dev-workflow/3-final/web/quill.dart b/dev-workflow/3-final/web/quill.dart new file mode 100644 index 0000000..c0c6dcc --- /dev/null +++ b/dev-workflow/3-final/web/quill.dart @@ -0,0 +1,168 @@ +// This version is autogenerated and contains some other small polish tweaks. For example see +// how String /*'api'|'user'|'silent'*/ source is handled. + +@JS() +library quill; + +import "package:js/js.dart"; +import "package:func/func.dart"; + +/// Type definitions for Quill v1.0.3 +/// Project: http://quilljs.com +/// Definitions by: Sumit +/// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// Module QuillJS +@anonymous +@JS() +abstract class QuillOptionsStatic { + external String get debug; + external set debug(String v); + external dynamic /*JSMap of */ get modules; + external set modules(dynamic /*JSMap of */ v); + external String get placeholder; + external set placeholder(String v); + external bool get readOnly; + external set readOnly(bool v); + external String get theme; + external set theme(String v); + external factory QuillOptionsStatic( + {String debug, + dynamic /*JSMap of */ modules, + String placeholder, + bool readOnly, + String theme}); +} + +@anonymous +@JS() +abstract class BoundsStatic { + external num get left; + external set left(num v); + external num get top; + external set top(num v); + external num get height; + external set height(num v); + external num get width; + external set width(num v); + external factory BoundsStatic({num left, num top, num height, num width}); +} + +@anonymous +@JS() +abstract class DeltaStatic { + external List get ops; + external set ops(List v); + external dynamic get retain; + external set retain(dynamic v); + external dynamic get delete; + external set delete(dynamic v); + external dynamic get insert; + external set insert(dynamic v); + external dynamic get attributes; + external set attributes(dynamic v); + external factory DeltaStatic( + {List ops, + dynamic retain, + dynamic delete, + dynamic insert, + dynamic attributes}); +} + +@anonymous +@JS() +abstract class RangeStatic { + external factory RangeStatic(); + external num get index; + external set index(num v); + external num get length; + external set length(num v); +} + +@JS("Quill") +abstract class QuillStatic { + external factory QuillStatic(String selector, [QuillOptionsStatic options]); + external void deleteText(num start, num end, + [String /*'api'|'user'|'silent'*/ source]); + external void disable(); + external void enable([bool enabled]); + external DeltaStatic getContents([num start, num end]); + external num getLength(); + external String getText([num start, num end]); + external void insertEmbed(num index, String type, String url, + [String /*'api'|'user'|'silent'*/ source]); + /*external void insertText(num index, String text, ['api'|'user'|'silent' source]);*/ + /*external void insertText(num index, String text, String format, String value, ['api'|'user'|'silent' source]);*/ + /*external void insertText(num index, String text, JSMap of formats, ['api'|'user'|'silent' source]);*/ + external void insertText(num index, String text, + [dynamic /*'api'|'user'|'silent'|String|JSMap of */ source_format_formats, + String /*String|'api'|'user'|'silent'*/ value_source, + String /*'api'|'user'|'silent'*/ source]); + /*external String pasteHTML(num index, String html, ['api'|'user'|'silent' source]);*/ + /*external String pasteHTML(String html, ['api'|'user'|'silent' source]);*/ + external String pasteHTML(dynamic /*num|String*/ index_html, + [String /*String|'api'|'user'|'silent'*/ html_source, + String /*'api'|'user'|'silent'*/ source]); + external void setContents(DeltaStatic delta, + [String /*'api'|'user'|'silent'*/ source]); + external void setText(String text, [String /*'api'|'user'|'silent'*/ source]); + external void update([String source]); + external void updateContents(DeltaStatic delta, + [String /*'api'|'user'|'silent'*/ source]); + external void format(String name, dynamic value, + [String /*'api'|'user'|'silent'*/ source]); + /*external void formatLine(num index, num length, ['api'|'user'|'silent' source]);*/ + /*external void formatLine(num index, num length, String format, dynamic value, ['api'|'user'|'silent' source]);*/ + /*external void formatLine(num index, num length, JSMap of formats, ['api'|'user'|'silent' source]);*/ + external void formatLine(num index, num length, + [dynamic /*'api'|'user'|'silent'|String|JSMap of */ source_format_formats, + dynamic /*dynamic|'api'|'user'|'silent'*/ value_source, + String /*'api'|'user'|'silent'*/ source]); + /*external void formatText(num index, num length, ['api'|'user'|'silent' source]);*/ + /*external void formatText(num index, num length, String format, dynamic value, ['api'|'user'|'silent' source]);*/ + /*external void formatText(num index, num length, JSMap of formats, ['api'|'user'|'silent' source]);*/ + external void formatText(num index, num length, + [dynamic /*'api'|'user'|'silent'|String|JSMap of */ source_format_formats, + dynamic /*dynamic|'api'|'user'|'silent'*/ value_source, + String /*'api'|'user'|'silent'*/ source]); + /*external JSMap of getFormat([RangeStatic range]);*/ + /*external JSMap of getFormat(num index, [num length]);*/ + external dynamic /*JSMap of */ getFormat( + [dynamic /*RangeStatic|num*/ range_index, num length]); + external void removeFormat(num index, num length, + [String /*'api'|'user'|'silent'*/ source]); + external void blur(); + external void focus(); + external BoundsStatic getBounds(num index, [num length]); + external RangeStatic getSelection([bool focus]); + external bool hasFocus(); + /*external void setSelection(num index, num length, ['api'|'user'|'silent' source]);*/ + /*external void setSelection(RangeStatic range, ['api'|'user'|'silent' source]);*/ + external void setSelection(dynamic /*num|RangeStatic*/ index_range, + [dynamic /*num|'api'|'user'|'silent'*/ length_source, + String /*'api'|'user'|'silent'*/ source]); + external QuillStatic on(String eventName, + dynamic /*VoidFunc3|(name: string, ...args: any[]) => void*/ callback); + external QuillStatic once( + String eventName, void callback(DeltaStatic delta, String source)); + external QuillStatic off( + String eventName, void callback(DeltaStatic delta, String source)); + external void debug(String level); + external dynamic JS$import(String path); + /*external void register(String path, dynamic def, [bool suppressWarning]);*/ + /*external void register(JSMap of defs, [bool suppressWarning]);*/ + external void register(dynamic /*String|JSMap of */ path_defs, + [dynamic /*dynamic|bool*/ def_suppressWarning, bool suppressWarning]); + external dynamic addContainer(String className, [dynamic refNode]); + external dynamic getModule(String name); +} + +// End module QuillJS +@JS("Quill") +external QuillStatic get Quill; +@JS("Quill") +external set Quill(QuillStatic v); +// Module Quill +/* WARNING: export assignment not yet supported. */ + +// End module Quill \ No newline at end of file diff --git a/dev-workflow/3-final/web/styles.css b/dev-workflow/3-final/web/styles.css new file mode 100644 index 0000000..49e1612 --- /dev/null +++ b/dev-workflow/3-final/web/styles.css @@ -0,0 +1,103 @@ +body { + padding: 0em; + margin: 0em; +} + +html { + background: #222; + color: white; + font-family: 'Jura', sans-serif; +} + +h1.title { + font-family: 'Orbitron', sans-serif; + font-size: 4em; + margin-top: 0px; + padding: 0.67em; +} + +h2.stardate { + font-family: 'Bungee Hairline', cursive; +} + +.buttons { + display: flex; + justify-content: space-between; + align-items: center; +} + +select { + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; + background-color: #222; + border: none; + color: inherit; + font-size: inherit; + padding: 5px; + padding-right: 18px; +} + +select:focus { + outline: none; +} + +select:active { + background-color: #222; +} + +div.select { + border-bottom: 1px solid gray; + display: inline-block; + height: 100%; + position: relative; +} + +div.select::after { + font-family: 'Material Icons'; + content: '\E5C5'; + position: absolute; + right: 2px; + top: 6px; + pointer-events: none; +} + +button { + background-color: #06c; + border-color: #06c; + border-radius: 5px; + font-family: inherit; + font-size: 1.1em; + margin: 5px; + padding: 20px; +} + +#editor .ql-editor.ql-blank::before { + color: white; +} + +.ql-toolbar .ql-stroke { + stroke: white; +} + +.ql-toolbar .ql-fill { + fill: white; +} + +.ql-toolbar.ql-snow .ql-picker-label { + color: white; +} + +#content { + margin-left: 20%; + margin-right: 20%; + padding-left: 2%; + padding-right: 2%; + background: rgba(22, 22, 22, 0.8); + background-clip: padding-box; +} + +#editor { + height: 20em; + font-size: 1.1em; +} diff --git a/dev-workflow/base b/dev-workflow/base deleted file mode 160000 index 9ef2b04..0000000 --- a/dev-workflow/base +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9ef2b0471418ea16e0dec3e7c254cdb9b6496d83 diff --git a/dev-workflow/final b/dev-workflow/final deleted file mode 160000 index 9ef2b04..0000000 --- a/dev-workflow/final +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9ef2b0471418ea16e0dec3e7c254cdb9b6496d83 From 93cb053ca149226a2fa033a6d5fb2511934c4242 Mon Sep 17 00:00:00 2001 From: Shams Zakhour Date: Mon, 10 Oct 2016 08:14:06 -0700 Subject: [PATCH 04/22] Renaming --- dev-workflow/1-base/web/index.html | 2 +- dev-workflow/1-base/web/main.dart | 2 - dev-workflow/2-final/.analysis_options | 14 ++ dev-workflow/2-final/.gitignore | 22 +++ dev-workflow/2-final/README.md | 2 + dev-workflow/2-final/pubspec.yaml | 14 ++ dev-workflow/2-final/web/.index.html.swp | Bin 0 -> 12288 bytes dev-workflow/2-final/web/index.html | 35 +++++ dev-workflow/2-final/web/main.dart | 122 ++++++++++++++++ dev-workflow/2-final/web/quill.dart | 168 +++++++++++++++++++++++ dev-workflow/2-final/web/styles.css | 103 ++++++++++++++ 11 files changed, 481 insertions(+), 3 deletions(-) create mode 100644 dev-workflow/2-final/.analysis_options create mode 100644 dev-workflow/2-final/.gitignore create mode 100644 dev-workflow/2-final/README.md create mode 100644 dev-workflow/2-final/pubspec.yaml create mode 100644 dev-workflow/2-final/web/.index.html.swp create mode 100644 dev-workflow/2-final/web/index.html create mode 100644 dev-workflow/2-final/web/main.dart create mode 100644 dev-workflow/2-final/web/quill.dart create mode 100644 dev-workflow/2-final/web/styles.css diff --git a/dev-workflow/1-base/web/index.html b/dev-workflow/1-base/web/index.html index 435587b..19a5fb4 100644 --- a/dev-workflow/1-base/web/index.html +++ b/dev-workflow/1-base/web/index.html @@ -10,7 +10,7 @@ rel="stylesheet"> - +

Captain's Log

diff --git a/dev-workflow/1-base/web/main.dart b/dev-workflow/1-base/web/main.dart index 1d33174..75a4a69 100644 --- a/dev-workflow/1-base/web/main.dart +++ b/dev-workflow/1-base/web/main.dart @@ -107,6 +107,4 @@ void useTemplate(Event _) { int selectedIndex = templateSelectElement.selectedIndex; if (selectedIndex == 0) return; - - String templateText = _templates[templateSelectElement.selectedIndex - 1]; } diff --git a/dev-workflow/2-final/.analysis_options b/dev-workflow/2-final/.analysis_options new file mode 100644 index 0000000..6237a10 --- /dev/null +++ b/dev-workflow/2-final/.analysis_options @@ -0,0 +1,14 @@ +# This file allows you to configure the Dart analyzer. +# +# The commented part below is just for inspiration. Read the guide here: +# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer + + analyzer: + strong-mode: true + exclude: + - web/quill.dart +# linter: +# rules: +# # see catalogue here: http://dart-lang.github.io/linter/lints/ +# - hash_and_equals + diff --git a/dev-workflow/2-final/.gitignore b/dev-workflow/2-final/.gitignore new file mode 100644 index 0000000..04d4ee3 --- /dev/null +++ b/dev-workflow/2-final/.gitignore @@ -0,0 +1,22 @@ +pubspec.lock +.buildlog +.packages +.project +.pub/ + +build/ +**/packages/ +web/gen +web/packages + +doc/api/ + +*.iml +*.ipr +*.iws +.idea/ +.DS_Store + +*.dart.js +*.info.json +*.js diff --git a/dev-workflow/2-final/README.md b/dev-workflow/2-final/README.md new file mode 100644 index 0000000..a87044a --- /dev/null +++ b/dev-workflow/2-final/README.md @@ -0,0 +1,2 @@ +# dart-jsinterop-quill +Testing Dart JS-interop with quilljs diff --git a/dev-workflow/2-final/pubspec.yaml b/dev-workflow/2-final/pubspec.yaml new file mode 100644 index 0000000..38ed882 --- /dev/null +++ b/dev-workflow/2-final/pubspec.yaml @@ -0,0 +1,14 @@ +name: captains_log +version: 0.0.1 +description: > + A starship captain's log with a WYSIWYG editor. Uses an existing JavaScript + library with the new Dart JS-interop. + +environment: + sdk: '>=1.17.0 <2.0.0' + +dependencies: + func: ^0.1.0 + js: ^0.6.1 + browser: any + html: any \ No newline at end of file diff --git a/dev-workflow/2-final/web/.index.html.swp b/dev-workflow/2-final/web/.index.html.swp new file mode 100644 index 0000000000000000000000000000000000000000..79cab8f1cec041f6bc6166190480cb5074aedf16 GIT binary patch literal 12288 zcmeI2&u<(x6vv&413y|oZN&iz$(>3d)XsP}L4eRqKxq*KCA1O&+H&%G-p)Aj*n{oO zW>EzH0_DJg3!J$E{{+V#xbiP>g$q2->~7N#8jetTq;F=%_IrNs6^*rk5rwO@(dJAkcYjkw7F62}A;sKqL?e zL<0YL0yzr@G}j5Gxf52lo;oXvq~&6dSK!#lnyCZJN^X6&>yq`H_2Z73_*n}@!rN9! z!M!xP8=my88ZLDf%ulxMrmMYg-5ZRFQfHq|q*A*soJM8CY>>Uex|Y9B&PJx3g)lI7 z7G~+6Lna_X6jYW)qD<9I+&3+Uuu|?XUeIDR@qTXL_&y}-AK+i=4c&&u*csj6de7yo zA9lpJ40(52KBopMX3($};$&PxTiV({u<$g|xRs~EGw z*@2hy`IXdrw6-utD1L@MGvQo9EvQ994bVpws*wIePkzMDBG!Pw&CiANR`$CQy}vo; zja0K@8!OmKuC8oi?(T47qAP$a?{aC;863VhvHb9c9Z7GEez8YcAW9OVIBC9zZG5NA z^t8<8D^Mg;S^B!bGwD)5+Pz$*6a0XsPH;S}uAtE7Ds7~e&7|oXp}?;UHt~Z8o0e5X zspbuS-}WU;Til!TEE@2<&nG-lQFH6S7s + + + Captain's Log + + + + + + + +
+

Captain's Log

+
+
+
+ +
+ +
+
+
+ + + + + diff --git a/dev-workflow/2-final/web/main.dart b/dev-workflow/2-final/web/main.dart new file mode 100644 index 0000000..8c02a72 --- /dev/null +++ b/dev-workflow/2-final/web/main.dart @@ -0,0 +1,122 @@ +import 'dart:html'; + +import 'quill.dart' as quill; + +// ignoring leap years +const int _secondsInAYear = 31536000; +const String _prompt = 'Something happened. Make it sound puzzling and heroic.'; +final List _templates = [ + 'We encountered what appeared to be a . It has ' + 'proven to be sentient and has taken control of our ship. Thus far, all ' + 'efforts at communication have failed...', + 'A warship from the has entered our ' + 'territory. It is currently speeding towards Earth. Thus far, all ' + 'efforts at peace have failed...', + 'The ship has been pulled into a . We are ' + 'observing the universe in the distant . Thus far, all ' + 'efforts to return to our timeline have failed...' +]; + +quill.QuillStatic quillEditor; +Map logEntries; +HtmlElement logElement; + +main() { + // initialization + quillEditor = new quill.QuillStatic('#editor', + new quill.QuillOptionsStatic(theme: 'snow', placeholder: _prompt)); + logElement = document.getElementById('log'); + logEntries = new Map(); + loadPreviousEntries(); + + // listeners + document.getElementById('save').onClick.listen(saveLog); + document.getElementById('templateSelect') as SelectElement + ..onChange.listen(useTemplate); +} + +/// Capture entry in editor, save to local storage and display in log. +void appendToLog(double stardate, HtmlElement logEntryElement) { + logEntries[stardate] = logEntryElement; + window.localStorage[stardate.toString()] = logEntryElement.innerHtml; + displayLogEntry(stardate, logEntryElement); +} + +/// Calculate the current stardate: . +double calculateStardate() { + var now = new DateTime.now(); + var beginningOfYear = new DateTime(now.year); + int secondsThisYear = now.difference(beginningOfYear).inSeconds; + return now.year + secondsThisYear / _secondsInAYear; +} + +/// Copy html elements from the editor view and return them inside a new +/// DivElement. +HtmlElement captureEditorView() { + Element contentElement = document.getElementById('editor').firstChild; + + var logEntryElement = new DivElement() + ..innerHtml = contentElement.innerHtml; + + return logEntryElement; +} + +void displayLogEntry(double stardate, HtmlElement logEntryElement) { +// var logElement = document.getElementById('log'); + + if (logElement.children.isNotEmpty) { + logElement.insertAdjacentElement('afterBegin', new HRElement()); + } + + logElement.insertAdjacentElement('afterBegin', logEntryElement); + var stardateElement = new HeadingElement.h2() + ..text = 'Stardate: $stardate' + ..classes.add('stardate'); + logElement.insertAdjacentElement('afterBegin', stardateElement); +} + +/// Load all log entries from browser local storage. +void loadPreviousEntries() { +// Element logElement = document.getElementById('log'); + logElement.innerHtml = window.localStorage['log'] ?? ''; + + List keys = window.localStorage.keys.toList(); + keys.sort(); + for (String key in keys) { + var entryElement = new DivElement() + ..innerHtml = window.localStorage[key]; + logEntries[double.parse(key)] = entryElement; + } + updateDisplay(); +} + +/// Save the log entry that is currently in the editor. +void saveLog(Event _) { + DivElement logEntryElement = captureEditorView(); + appendToLog(calculateStardate(), logEntryElement); + + // Clear the editor. + quillEditor.deleteText(0, quillEditor.getLength()); +} + +void updateDisplay() { + logElement.innerHtml = ''; + List keys = logEntries.keys.toList(); + keys.sort(); + for (double key in keys) { + displayLogEntry(key, logEntries[key]); + } +} + +/// Updates the content of the editor using the selected template. +void useTemplate(Event _) { + SelectElement templateSelectElement = + document.getElementById('templateSelect'); + int selectedIndex = templateSelectElement.selectedIndex; + + if (selectedIndex == 0) return; + + quillEditor.deleteText(0, quillEditor.getLength()); + String templateText = _templates[templateSelectElement.selectedIndex - 1]; + quillEditor.insertText(0, templateText, 'api'); +} \ No newline at end of file diff --git a/dev-workflow/2-final/web/quill.dart b/dev-workflow/2-final/web/quill.dart new file mode 100644 index 0000000..c0c6dcc --- /dev/null +++ b/dev-workflow/2-final/web/quill.dart @@ -0,0 +1,168 @@ +// This version is autogenerated and contains some other small polish tweaks. For example see +// how String /*'api'|'user'|'silent'*/ source is handled. + +@JS() +library quill; + +import "package:js/js.dart"; +import "package:func/func.dart"; + +/// Type definitions for Quill v1.0.3 +/// Project: http://quilljs.com +/// Definitions by: Sumit +/// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// Module QuillJS +@anonymous +@JS() +abstract class QuillOptionsStatic { + external String get debug; + external set debug(String v); + external dynamic /*JSMap of */ get modules; + external set modules(dynamic /*JSMap of */ v); + external String get placeholder; + external set placeholder(String v); + external bool get readOnly; + external set readOnly(bool v); + external String get theme; + external set theme(String v); + external factory QuillOptionsStatic( + {String debug, + dynamic /*JSMap of */ modules, + String placeholder, + bool readOnly, + String theme}); +} + +@anonymous +@JS() +abstract class BoundsStatic { + external num get left; + external set left(num v); + external num get top; + external set top(num v); + external num get height; + external set height(num v); + external num get width; + external set width(num v); + external factory BoundsStatic({num left, num top, num height, num width}); +} + +@anonymous +@JS() +abstract class DeltaStatic { + external List get ops; + external set ops(List v); + external dynamic get retain; + external set retain(dynamic v); + external dynamic get delete; + external set delete(dynamic v); + external dynamic get insert; + external set insert(dynamic v); + external dynamic get attributes; + external set attributes(dynamic v); + external factory DeltaStatic( + {List ops, + dynamic retain, + dynamic delete, + dynamic insert, + dynamic attributes}); +} + +@anonymous +@JS() +abstract class RangeStatic { + external factory RangeStatic(); + external num get index; + external set index(num v); + external num get length; + external set length(num v); +} + +@JS("Quill") +abstract class QuillStatic { + external factory QuillStatic(String selector, [QuillOptionsStatic options]); + external void deleteText(num start, num end, + [String /*'api'|'user'|'silent'*/ source]); + external void disable(); + external void enable([bool enabled]); + external DeltaStatic getContents([num start, num end]); + external num getLength(); + external String getText([num start, num end]); + external void insertEmbed(num index, String type, String url, + [String /*'api'|'user'|'silent'*/ source]); + /*external void insertText(num index, String text, ['api'|'user'|'silent' source]);*/ + /*external void insertText(num index, String text, String format, String value, ['api'|'user'|'silent' source]);*/ + /*external void insertText(num index, String text, JSMap of formats, ['api'|'user'|'silent' source]);*/ + external void insertText(num index, String text, + [dynamic /*'api'|'user'|'silent'|String|JSMap of */ source_format_formats, + String /*String|'api'|'user'|'silent'*/ value_source, + String /*'api'|'user'|'silent'*/ source]); + /*external String pasteHTML(num index, String html, ['api'|'user'|'silent' source]);*/ + /*external String pasteHTML(String html, ['api'|'user'|'silent' source]);*/ + external String pasteHTML(dynamic /*num|String*/ index_html, + [String /*String|'api'|'user'|'silent'*/ html_source, + String /*'api'|'user'|'silent'*/ source]); + external void setContents(DeltaStatic delta, + [String /*'api'|'user'|'silent'*/ source]); + external void setText(String text, [String /*'api'|'user'|'silent'*/ source]); + external void update([String source]); + external void updateContents(DeltaStatic delta, + [String /*'api'|'user'|'silent'*/ source]); + external void format(String name, dynamic value, + [String /*'api'|'user'|'silent'*/ source]); + /*external void formatLine(num index, num length, ['api'|'user'|'silent' source]);*/ + /*external void formatLine(num index, num length, String format, dynamic value, ['api'|'user'|'silent' source]);*/ + /*external void formatLine(num index, num length, JSMap of formats, ['api'|'user'|'silent' source]);*/ + external void formatLine(num index, num length, + [dynamic /*'api'|'user'|'silent'|String|JSMap of */ source_format_formats, + dynamic /*dynamic|'api'|'user'|'silent'*/ value_source, + String /*'api'|'user'|'silent'*/ source]); + /*external void formatText(num index, num length, ['api'|'user'|'silent' source]);*/ + /*external void formatText(num index, num length, String format, dynamic value, ['api'|'user'|'silent' source]);*/ + /*external void formatText(num index, num length, JSMap of formats, ['api'|'user'|'silent' source]);*/ + external void formatText(num index, num length, + [dynamic /*'api'|'user'|'silent'|String|JSMap of */ source_format_formats, + dynamic /*dynamic|'api'|'user'|'silent'*/ value_source, + String /*'api'|'user'|'silent'*/ source]); + /*external JSMap of getFormat([RangeStatic range]);*/ + /*external JSMap of getFormat(num index, [num length]);*/ + external dynamic /*JSMap of */ getFormat( + [dynamic /*RangeStatic|num*/ range_index, num length]); + external void removeFormat(num index, num length, + [String /*'api'|'user'|'silent'*/ source]); + external void blur(); + external void focus(); + external BoundsStatic getBounds(num index, [num length]); + external RangeStatic getSelection([bool focus]); + external bool hasFocus(); + /*external void setSelection(num index, num length, ['api'|'user'|'silent' source]);*/ + /*external void setSelection(RangeStatic range, ['api'|'user'|'silent' source]);*/ + external void setSelection(dynamic /*num|RangeStatic*/ index_range, + [dynamic /*num|'api'|'user'|'silent'*/ length_source, + String /*'api'|'user'|'silent'*/ source]); + external QuillStatic on(String eventName, + dynamic /*VoidFunc3|(name: string, ...args: any[]) => void*/ callback); + external QuillStatic once( + String eventName, void callback(DeltaStatic delta, String source)); + external QuillStatic off( + String eventName, void callback(DeltaStatic delta, String source)); + external void debug(String level); + external dynamic JS$import(String path); + /*external void register(String path, dynamic def, [bool suppressWarning]);*/ + /*external void register(JSMap of defs, [bool suppressWarning]);*/ + external void register(dynamic /*String|JSMap of */ path_defs, + [dynamic /*dynamic|bool*/ def_suppressWarning, bool suppressWarning]); + external dynamic addContainer(String className, [dynamic refNode]); + external dynamic getModule(String name); +} + +// End module QuillJS +@JS("Quill") +external QuillStatic get Quill; +@JS("Quill") +external set Quill(QuillStatic v); +// Module Quill +/* WARNING: export assignment not yet supported. */ + +// End module Quill \ No newline at end of file diff --git a/dev-workflow/2-final/web/styles.css b/dev-workflow/2-final/web/styles.css new file mode 100644 index 0000000..49e1612 --- /dev/null +++ b/dev-workflow/2-final/web/styles.css @@ -0,0 +1,103 @@ +body { + padding: 0em; + margin: 0em; +} + +html { + background: #222; + color: white; + font-family: 'Jura', sans-serif; +} + +h1.title { + font-family: 'Orbitron', sans-serif; + font-size: 4em; + margin-top: 0px; + padding: 0.67em; +} + +h2.stardate { + font-family: 'Bungee Hairline', cursive; +} + +.buttons { + display: flex; + justify-content: space-between; + align-items: center; +} + +select { + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; + background-color: #222; + border: none; + color: inherit; + font-size: inherit; + padding: 5px; + padding-right: 18px; +} + +select:focus { + outline: none; +} + +select:active { + background-color: #222; +} + +div.select { + border-bottom: 1px solid gray; + display: inline-block; + height: 100%; + position: relative; +} + +div.select::after { + font-family: 'Material Icons'; + content: '\E5C5'; + position: absolute; + right: 2px; + top: 6px; + pointer-events: none; +} + +button { + background-color: #06c; + border-color: #06c; + border-radius: 5px; + font-family: inherit; + font-size: 1.1em; + margin: 5px; + padding: 20px; +} + +#editor .ql-editor.ql-blank::before { + color: white; +} + +.ql-toolbar .ql-stroke { + stroke: white; +} + +.ql-toolbar .ql-fill { + fill: white; +} + +.ql-toolbar.ql-snow .ql-picker-label { + color: white; +} + +#content { + margin-left: 20%; + margin-right: 20%; + padding-left: 2%; + padding-right: 2%; + background: rgba(22, 22, 22, 0.8); + background-clip: padding-box; +} + +#editor { + height: 20em; + font-size: 1.1em; +} From 95891bae899b6eed885d7904f8ba616719d6da70 Mon Sep 17 00:00:00 2001 From: Shams Zakhour Date: Mon, 10 Oct 2016 08:16:07 -0700 Subject: [PATCH 05/22] Deleting old version --- dev-workflow/3-final/.analysis_options | 14 --- dev-workflow/3-final/.gitignore | 22 ---- dev-workflow/3-final/README.md | 2 - dev-workflow/3-final/pubspec.yaml | 14 --- dev-workflow/3-final/web/index.html | 35 ------ dev-workflow/3-final/web/main.dart | 122 ------------------ dev-workflow/3-final/web/quill.dart | 168 ------------------------- dev-workflow/3-final/web/styles.css | 103 --------------- 8 files changed, 480 deletions(-) delete mode 100644 dev-workflow/3-final/.analysis_options delete mode 100644 dev-workflow/3-final/.gitignore delete mode 100644 dev-workflow/3-final/README.md delete mode 100644 dev-workflow/3-final/pubspec.yaml delete mode 100644 dev-workflow/3-final/web/index.html delete mode 100644 dev-workflow/3-final/web/main.dart delete mode 100644 dev-workflow/3-final/web/quill.dart delete mode 100644 dev-workflow/3-final/web/styles.css diff --git a/dev-workflow/3-final/.analysis_options b/dev-workflow/3-final/.analysis_options deleted file mode 100644 index 6237a10..0000000 --- a/dev-workflow/3-final/.analysis_options +++ /dev/null @@ -1,14 +0,0 @@ -# This file allows you to configure the Dart analyzer. -# -# The commented part below is just for inspiration. Read the guide here: -# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer - - analyzer: - strong-mode: true - exclude: - - web/quill.dart -# linter: -# rules: -# # see catalogue here: http://dart-lang.github.io/linter/lints/ -# - hash_and_equals - diff --git a/dev-workflow/3-final/.gitignore b/dev-workflow/3-final/.gitignore deleted file mode 100644 index 04d4ee3..0000000 --- a/dev-workflow/3-final/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -pubspec.lock -.buildlog -.packages -.project -.pub/ - -build/ -**/packages/ -web/gen -web/packages - -doc/api/ - -*.iml -*.ipr -*.iws -.idea/ -.DS_Store - -*.dart.js -*.info.json -*.js diff --git a/dev-workflow/3-final/README.md b/dev-workflow/3-final/README.md deleted file mode 100644 index a87044a..0000000 --- a/dev-workflow/3-final/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# dart-jsinterop-quill -Testing Dart JS-interop with quilljs diff --git a/dev-workflow/3-final/pubspec.yaml b/dev-workflow/3-final/pubspec.yaml deleted file mode 100644 index 38ed882..0000000 --- a/dev-workflow/3-final/pubspec.yaml +++ /dev/null @@ -1,14 +0,0 @@ -name: captains_log -version: 0.0.1 -description: > - A starship captain's log with a WYSIWYG editor. Uses an existing JavaScript - library with the new Dart JS-interop. - -environment: - sdk: '>=1.17.0 <2.0.0' - -dependencies: - func: ^0.1.0 - js: ^0.6.1 - browser: any - html: any \ No newline at end of file diff --git a/dev-workflow/3-final/web/index.html b/dev-workflow/3-final/web/index.html deleted file mode 100644 index 2e5ed88..0000000 --- a/dev-workflow/3-final/web/index.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - Captain's Log - - - - - - - -
-

Captain's Log

-
-
-
- -
- -
-
-
- - - - - diff --git a/dev-workflow/3-final/web/main.dart b/dev-workflow/3-final/web/main.dart deleted file mode 100644 index 8c02a72..0000000 --- a/dev-workflow/3-final/web/main.dart +++ /dev/null @@ -1,122 +0,0 @@ -import 'dart:html'; - -import 'quill.dart' as quill; - -// ignoring leap years -const int _secondsInAYear = 31536000; -const String _prompt = 'Something happened. Make it sound puzzling and heroic.'; -final List _templates = [ - 'We encountered what appeared to be a . It has ' - 'proven to be sentient and has taken control of our ship. Thus far, all ' - 'efforts at communication have failed...', - 'A warship from the has entered our ' - 'territory. It is currently speeding towards Earth. Thus far, all ' - 'efforts at peace have failed...', - 'The ship has been pulled into a . We are ' - 'observing the universe in the distant . Thus far, all ' - 'efforts to return to our timeline have failed...' -]; - -quill.QuillStatic quillEditor; -Map logEntries; -HtmlElement logElement; - -main() { - // initialization - quillEditor = new quill.QuillStatic('#editor', - new quill.QuillOptionsStatic(theme: 'snow', placeholder: _prompt)); - logElement = document.getElementById('log'); - logEntries = new Map(); - loadPreviousEntries(); - - // listeners - document.getElementById('save').onClick.listen(saveLog); - document.getElementById('templateSelect') as SelectElement - ..onChange.listen(useTemplate); -} - -/// Capture entry in editor, save to local storage and display in log. -void appendToLog(double stardate, HtmlElement logEntryElement) { - logEntries[stardate] = logEntryElement; - window.localStorage[stardate.toString()] = logEntryElement.innerHtml; - displayLogEntry(stardate, logEntryElement); -} - -/// Calculate the current stardate: . -double calculateStardate() { - var now = new DateTime.now(); - var beginningOfYear = new DateTime(now.year); - int secondsThisYear = now.difference(beginningOfYear).inSeconds; - return now.year + secondsThisYear / _secondsInAYear; -} - -/// Copy html elements from the editor view and return them inside a new -/// DivElement. -HtmlElement captureEditorView() { - Element contentElement = document.getElementById('editor').firstChild; - - var logEntryElement = new DivElement() - ..innerHtml = contentElement.innerHtml; - - return logEntryElement; -} - -void displayLogEntry(double stardate, HtmlElement logEntryElement) { -// var logElement = document.getElementById('log'); - - if (logElement.children.isNotEmpty) { - logElement.insertAdjacentElement('afterBegin', new HRElement()); - } - - logElement.insertAdjacentElement('afterBegin', logEntryElement); - var stardateElement = new HeadingElement.h2() - ..text = 'Stardate: $stardate' - ..classes.add('stardate'); - logElement.insertAdjacentElement('afterBegin', stardateElement); -} - -/// Load all log entries from browser local storage. -void loadPreviousEntries() { -// Element logElement = document.getElementById('log'); - logElement.innerHtml = window.localStorage['log'] ?? ''; - - List keys = window.localStorage.keys.toList(); - keys.sort(); - for (String key in keys) { - var entryElement = new DivElement() - ..innerHtml = window.localStorage[key]; - logEntries[double.parse(key)] = entryElement; - } - updateDisplay(); -} - -/// Save the log entry that is currently in the editor. -void saveLog(Event _) { - DivElement logEntryElement = captureEditorView(); - appendToLog(calculateStardate(), logEntryElement); - - // Clear the editor. - quillEditor.deleteText(0, quillEditor.getLength()); -} - -void updateDisplay() { - logElement.innerHtml = ''; - List keys = logEntries.keys.toList(); - keys.sort(); - for (double key in keys) { - displayLogEntry(key, logEntries[key]); - } -} - -/// Updates the content of the editor using the selected template. -void useTemplate(Event _) { - SelectElement templateSelectElement = - document.getElementById('templateSelect'); - int selectedIndex = templateSelectElement.selectedIndex; - - if (selectedIndex == 0) return; - - quillEditor.deleteText(0, quillEditor.getLength()); - String templateText = _templates[templateSelectElement.selectedIndex - 1]; - quillEditor.insertText(0, templateText, 'api'); -} \ No newline at end of file diff --git a/dev-workflow/3-final/web/quill.dart b/dev-workflow/3-final/web/quill.dart deleted file mode 100644 index c0c6dcc..0000000 --- a/dev-workflow/3-final/web/quill.dart +++ /dev/null @@ -1,168 +0,0 @@ -// This version is autogenerated and contains some other small polish tweaks. For example see -// how String /*'api'|'user'|'silent'*/ source is handled. - -@JS() -library quill; - -import "package:js/js.dart"; -import "package:func/func.dart"; - -/// Type definitions for Quill v1.0.3 -/// Project: http://quilljs.com -/// Definitions by: Sumit -/// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -// Module QuillJS -@anonymous -@JS() -abstract class QuillOptionsStatic { - external String get debug; - external set debug(String v); - external dynamic /*JSMap of */ get modules; - external set modules(dynamic /*JSMap of */ v); - external String get placeholder; - external set placeholder(String v); - external bool get readOnly; - external set readOnly(bool v); - external String get theme; - external set theme(String v); - external factory QuillOptionsStatic( - {String debug, - dynamic /*JSMap of */ modules, - String placeholder, - bool readOnly, - String theme}); -} - -@anonymous -@JS() -abstract class BoundsStatic { - external num get left; - external set left(num v); - external num get top; - external set top(num v); - external num get height; - external set height(num v); - external num get width; - external set width(num v); - external factory BoundsStatic({num left, num top, num height, num width}); -} - -@anonymous -@JS() -abstract class DeltaStatic { - external List get ops; - external set ops(List v); - external dynamic get retain; - external set retain(dynamic v); - external dynamic get delete; - external set delete(dynamic v); - external dynamic get insert; - external set insert(dynamic v); - external dynamic get attributes; - external set attributes(dynamic v); - external factory DeltaStatic( - {List ops, - dynamic retain, - dynamic delete, - dynamic insert, - dynamic attributes}); -} - -@anonymous -@JS() -abstract class RangeStatic { - external factory RangeStatic(); - external num get index; - external set index(num v); - external num get length; - external set length(num v); -} - -@JS("Quill") -abstract class QuillStatic { - external factory QuillStatic(String selector, [QuillOptionsStatic options]); - external void deleteText(num start, num end, - [String /*'api'|'user'|'silent'*/ source]); - external void disable(); - external void enable([bool enabled]); - external DeltaStatic getContents([num start, num end]); - external num getLength(); - external String getText([num start, num end]); - external void insertEmbed(num index, String type, String url, - [String /*'api'|'user'|'silent'*/ source]); - /*external void insertText(num index, String text, ['api'|'user'|'silent' source]);*/ - /*external void insertText(num index, String text, String format, String value, ['api'|'user'|'silent' source]);*/ - /*external void insertText(num index, String text, JSMap of formats, ['api'|'user'|'silent' source]);*/ - external void insertText(num index, String text, - [dynamic /*'api'|'user'|'silent'|String|JSMap of */ source_format_formats, - String /*String|'api'|'user'|'silent'*/ value_source, - String /*'api'|'user'|'silent'*/ source]); - /*external String pasteHTML(num index, String html, ['api'|'user'|'silent' source]);*/ - /*external String pasteHTML(String html, ['api'|'user'|'silent' source]);*/ - external String pasteHTML(dynamic /*num|String*/ index_html, - [String /*String|'api'|'user'|'silent'*/ html_source, - String /*'api'|'user'|'silent'*/ source]); - external void setContents(DeltaStatic delta, - [String /*'api'|'user'|'silent'*/ source]); - external void setText(String text, [String /*'api'|'user'|'silent'*/ source]); - external void update([String source]); - external void updateContents(DeltaStatic delta, - [String /*'api'|'user'|'silent'*/ source]); - external void format(String name, dynamic value, - [String /*'api'|'user'|'silent'*/ source]); - /*external void formatLine(num index, num length, ['api'|'user'|'silent' source]);*/ - /*external void formatLine(num index, num length, String format, dynamic value, ['api'|'user'|'silent' source]);*/ - /*external void formatLine(num index, num length, JSMap of formats, ['api'|'user'|'silent' source]);*/ - external void formatLine(num index, num length, - [dynamic /*'api'|'user'|'silent'|String|JSMap of */ source_format_formats, - dynamic /*dynamic|'api'|'user'|'silent'*/ value_source, - String /*'api'|'user'|'silent'*/ source]); - /*external void formatText(num index, num length, ['api'|'user'|'silent' source]);*/ - /*external void formatText(num index, num length, String format, dynamic value, ['api'|'user'|'silent' source]);*/ - /*external void formatText(num index, num length, JSMap of formats, ['api'|'user'|'silent' source]);*/ - external void formatText(num index, num length, - [dynamic /*'api'|'user'|'silent'|String|JSMap of */ source_format_formats, - dynamic /*dynamic|'api'|'user'|'silent'*/ value_source, - String /*'api'|'user'|'silent'*/ source]); - /*external JSMap of getFormat([RangeStatic range]);*/ - /*external JSMap of getFormat(num index, [num length]);*/ - external dynamic /*JSMap of */ getFormat( - [dynamic /*RangeStatic|num*/ range_index, num length]); - external void removeFormat(num index, num length, - [String /*'api'|'user'|'silent'*/ source]); - external void blur(); - external void focus(); - external BoundsStatic getBounds(num index, [num length]); - external RangeStatic getSelection([bool focus]); - external bool hasFocus(); - /*external void setSelection(num index, num length, ['api'|'user'|'silent' source]);*/ - /*external void setSelection(RangeStatic range, ['api'|'user'|'silent' source]);*/ - external void setSelection(dynamic /*num|RangeStatic*/ index_range, - [dynamic /*num|'api'|'user'|'silent'*/ length_source, - String /*'api'|'user'|'silent'*/ source]); - external QuillStatic on(String eventName, - dynamic /*VoidFunc3|(name: string, ...args: any[]) => void*/ callback); - external QuillStatic once( - String eventName, void callback(DeltaStatic delta, String source)); - external QuillStatic off( - String eventName, void callback(DeltaStatic delta, String source)); - external void debug(String level); - external dynamic JS$import(String path); - /*external void register(String path, dynamic def, [bool suppressWarning]);*/ - /*external void register(JSMap of defs, [bool suppressWarning]);*/ - external void register(dynamic /*String|JSMap of */ path_defs, - [dynamic /*dynamic|bool*/ def_suppressWarning, bool suppressWarning]); - external dynamic addContainer(String className, [dynamic refNode]); - external dynamic getModule(String name); -} - -// End module QuillJS -@JS("Quill") -external QuillStatic get Quill; -@JS("Quill") -external set Quill(QuillStatic v); -// Module Quill -/* WARNING: export assignment not yet supported. */ - -// End module Quill \ No newline at end of file diff --git a/dev-workflow/3-final/web/styles.css b/dev-workflow/3-final/web/styles.css deleted file mode 100644 index 49e1612..0000000 --- a/dev-workflow/3-final/web/styles.css +++ /dev/null @@ -1,103 +0,0 @@ -body { - padding: 0em; - margin: 0em; -} - -html { - background: #222; - color: white; - font-family: 'Jura', sans-serif; -} - -h1.title { - font-family: 'Orbitron', sans-serif; - font-size: 4em; - margin-top: 0px; - padding: 0.67em; -} - -h2.stardate { - font-family: 'Bungee Hairline', cursive; -} - -.buttons { - display: flex; - justify-content: space-between; - align-items: center; -} - -select { - -moz-appearance: none; - -webkit-appearance: none; - appearance: none; - background-color: #222; - border: none; - color: inherit; - font-size: inherit; - padding: 5px; - padding-right: 18px; -} - -select:focus { - outline: none; -} - -select:active { - background-color: #222; -} - -div.select { - border-bottom: 1px solid gray; - display: inline-block; - height: 100%; - position: relative; -} - -div.select::after { - font-family: 'Material Icons'; - content: '\E5C5'; - position: absolute; - right: 2px; - top: 6px; - pointer-events: none; -} - -button { - background-color: #06c; - border-color: #06c; - border-radius: 5px; - font-family: inherit; - font-size: 1.1em; - margin: 5px; - padding: 20px; -} - -#editor .ql-editor.ql-blank::before { - color: white; -} - -.ql-toolbar .ql-stroke { - stroke: white; -} - -.ql-toolbar .ql-fill { - fill: white; -} - -.ql-toolbar.ql-snow .ql-picker-label { - color: white; -} - -#content { - margin-left: 20%; - margin-right: 20%; - padding-left: 2%; - padding-right: 2%; - background: rgba(22, 22, 22, 0.8); - background-clip: padding-box; -} - -#editor { - height: 20em; - font-size: 1.1em; -} From 0ed7a556f06575b71b576b620606ea29bbd5a8a0 Mon Sep 17 00:00:00 2001 From: Shams Zakhour Date: Mon, 10 Oct 2016 08:18:41 -0700 Subject: [PATCH 06/22] Deleting extraneous files --- dev-workflow/2-final/README.md | 2 -- dev-workflow/2-final/web/.index.html.swp | Bin 12288 -> 0 bytes 2 files changed, 2 deletions(-) delete mode 100644 dev-workflow/2-final/README.md delete mode 100644 dev-workflow/2-final/web/.index.html.swp diff --git a/dev-workflow/2-final/README.md b/dev-workflow/2-final/README.md deleted file mode 100644 index a87044a..0000000 --- a/dev-workflow/2-final/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# dart-jsinterop-quill -Testing Dart JS-interop with quilljs diff --git a/dev-workflow/2-final/web/.index.html.swp b/dev-workflow/2-final/web/.index.html.swp deleted file mode 100644 index 79cab8f1cec041f6bc6166190480cb5074aedf16..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2&u<(x6vv&413y|oZN&iz$(>3d)XsP}L4eRqKxq*KCA1O&+H&%G-p)Aj*n{oO zW>EzH0_DJg3!J$E{{+V#xbiP>g$q2->~7N#8jetTq;F=%_IrNs6^*rk5rwO@(dJAkcYjkw7F62}A;sKqL?e zL<0YL0yzr@G}j5Gxf52lo;oXvq~&6dSK!#lnyCZJN^X6&>yq`H_2Z73_*n}@!rN9! z!M!xP8=my88ZLDf%ulxMrmMYg-5ZRFQfHq|q*A*soJM8CY>>Uex|Y9B&PJx3g)lI7 z7G~+6Lna_X6jYW)qD<9I+&3+Uuu|?XUeIDR@qTXL_&y}-AK+i=4c&&u*csj6de7yo zA9lpJ40(52KBopMX3($};$&PxTiV({u<$g|xRs~EGw z*@2hy`IXdrw6-utD1L@MGvQo9EvQ994bVpws*wIePkzMDBG!Pw&CiANR`$CQy}vo; zja0K@8!OmKuC8oi?(T47qAP$a?{aC;863VhvHb9c9Z7GEez8YcAW9OVIBC9zZG5NA z^t8<8D^Mg;S^B!bGwD)5+Pz$*6a0XsPH;S}uAtE7Ds7~e&7|oXp}?;UHt~Z8o0e5X zspbuS-}WU;Til!TEE@2<&nG-lQFH6S7s Date: Thu, 13 Oct 2016 10:13:24 -0700 Subject: [PATCH 07/22] Some minor tweaks, such as changing the text in the button to white for better readability. --- dev-workflow/1-base/pubspec.yaml | 5 +++-- dev-workflow/1-base/web/index.html | 1 - dev-workflow/1-base/web/styles.css | 1 + dev-workflow/2-final/pubspec.yaml | 5 +++-- dev-workflow/2-final/web/styles.css | 1 + 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dev-workflow/1-base/pubspec.yaml b/dev-workflow/1-base/pubspec.yaml index 38ed882..2ff75a3 100644 --- a/dev-workflow/1-base/pubspec.yaml +++ b/dev-workflow/1-base/pubspec.yaml @@ -10,5 +10,6 @@ environment: dependencies: func: ^0.1.0 js: ^0.6.1 - browser: any - html: any \ No newline at end of file + browser: ^0.10.0 + html: ^0.13.0 + dart_to_js_script_rewriter: ^1.0.1 diff --git a/dev-workflow/1-base/web/index.html b/dev-workflow/1-base/web/index.html index 19a5fb4..435b3ba 100644 --- a/dev-workflow/1-base/web/index.html +++ b/dev-workflow/1-base/web/index.html @@ -13,7 +13,6 @@

Captain's Log

-
diff --git a/dev-workflow/1-base/web/main.dart b/dev-workflow/1-base/web/main.dart index 75a4a69..750119b 100644 --- a/dev-workflow/1-base/web/main.dart +++ b/dev-workflow/1-base/web/main.dart @@ -20,6 +20,8 @@ HtmlElement logElement; main() { // initialization + // TODO: Add Quill editor + logElement = document.getElementById('log'); logEntries = new Map(); loadPreviousEntries(); @@ -50,15 +52,13 @@ double calculateStardate() { HtmlElement captureEditorView() { Element contentElement = document.getElementById('editor').firstChild; - var logEntryElement = new DivElement() - ..innerHtml = contentElement.innerHtml; + var logEntryElement = new DivElement()..innerHtml = contentElement.innerHtml; return logEntryElement; } +/// Update the dom with the provided log entry. void displayLogEntry(double stardate, HtmlElement logEntryElement) { -// var logElement = document.getElementById('log'); - if (logElement.children.isNotEmpty) { logElement.insertAdjacentElement('afterBegin', new HRElement()); } @@ -72,14 +72,10 @@ void displayLogEntry(double stardate, HtmlElement logEntryElement) { /// Load all log entries from browser local storage. void loadPreviousEntries() { -// Element logElement = document.getElementById('log'); - logElement.innerHtml = window.localStorage['log'] ?? ''; - List keys = window.localStorage.keys.toList(); keys.sort(); for (String key in keys) { - var entryElement = new DivElement() - ..innerHtml = window.localStorage[key]; + var entryElement = new DivElement()..innerHtml = window.localStorage[key]; logEntries[double.parse(key)] = entryElement; } updateDisplay(); @@ -87,24 +83,26 @@ void loadPreviousEntries() { /// Save the log entry that is currently in the editor. void saveLog(Event _) { - DivElement logEntryElement = captureEditorView(); - appendToLog(calculateStardate(), logEntryElement); + // TODO: Need to save the text from the editor } +/// Update the dom to show all current log entries. void updateDisplay() { logElement.innerHtml = ''; - List keys = logEntries.keys.toList(); - keys.sort(); - for (double key in keys) { - displayLogEntry(key, logEntries[key]); + List starDates = logEntries.keys.toList(); + starDates.sort(); + for (double starDate in starDates) { + displayLogEntry(starDate, logEntries[starDate]); } } /// Updates the content of the editor using the selected template. void useTemplate(Event _) { SelectElement templateSelectElement = - document.getElementById('templateSelect'); + document.getElementById('templateSelect'); int selectedIndex = templateSelectElement.selectedIndex; if (selectedIndex == 0) return; + + // TODO: Need to clear the editor and insert the template } diff --git a/dev-workflow/1-base/web/styles.css b/dev-workflow/1-base/web/styles.css index 145148f..901432e 100644 --- a/dev-workflow/1-base/web/styles.css +++ b/dev-workflow/1-base/web/styles.css @@ -12,7 +12,7 @@ html { h1.title { font-family: 'Orbitron', sans-serif; font-size: 4em; - margin-top: 0px; + margin: 0em; padding: 0.67em; } @@ -66,11 +66,13 @@ button { background-color: #06c; color: white; border-color: #06c; - border-radius: 5px; + border-radius: 0.25em; font-family: inherit; font-size: 1.1em; - margin: 5px; - padding: 20px; + margin-top: .5em; + margin-left: 0.5em; + margin-bottom: 0.5em; + padding: .5em; } #editor .ql-editor.ql-blank::before { @@ -92,9 +94,10 @@ button { #content { margin-left: 20%; margin-right: 20%; - padding-left: 2%; - padding-right: 2%; - background: rgba(22, 22, 22, 0.8); + padding-left: 20px; + padding-right: 20px; + padding-bottom: 20px; + background: rgba(22, 22, 22, 0.9); background-clip: padding-box; } diff --git a/dev-workflow/2-final/web/index.html b/dev-workflow/2-final/web/index.html index 2e5ed88..a2770c4 100644 --- a/dev-workflow/2-final/web/index.html +++ b/dev-workflow/2-final/web/index.html @@ -7,13 +7,13 @@ name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> - - +
-

Captain's Log

+

Captain's Log

diff --git a/dev-workflow/2-final/web/main.dart b/dev-workflow/2-final/web/main.dart index 8c02a72..b24d88e 100644 --- a/dev-workflow/2-final/web/main.dart +++ b/dev-workflow/2-final/web/main.dart @@ -55,15 +55,13 @@ double calculateStardate() { HtmlElement captureEditorView() { Element contentElement = document.getElementById('editor').firstChild; - var logEntryElement = new DivElement() - ..innerHtml = contentElement.innerHtml; + var logEntryElement = new DivElement()..innerHtml = contentElement.innerHtml; return logEntryElement; } +/// Update the dom with the provided log entry. void displayLogEntry(double stardate, HtmlElement logEntryElement) { -// var logElement = document.getElementById('log'); - if (logElement.children.isNotEmpty) { logElement.insertAdjacentElement('afterBegin', new HRElement()); } @@ -77,14 +75,10 @@ void displayLogEntry(double stardate, HtmlElement logEntryElement) { /// Load all log entries from browser local storage. void loadPreviousEntries() { -// Element logElement = document.getElementById('log'); - logElement.innerHtml = window.localStorage['log'] ?? ''; - List keys = window.localStorage.keys.toList(); keys.sort(); for (String key in keys) { - var entryElement = new DivElement() - ..innerHtml = window.localStorage[key]; + var entryElement = new DivElement()..innerHtml = window.localStorage[key]; logEntries[double.parse(key)] = entryElement; } updateDisplay(); @@ -99,19 +93,20 @@ void saveLog(Event _) { quillEditor.deleteText(0, quillEditor.getLength()); } +/// Update the dom to show all current log entries. void updateDisplay() { logElement.innerHtml = ''; - List keys = logEntries.keys.toList(); - keys.sort(); - for (double key in keys) { - displayLogEntry(key, logEntries[key]); + List starDates = logEntries.keys.toList(); + starDates.sort(); + for (double starDate in starDates) { + displayLogEntry(starDate, logEntries[starDate]); } } /// Updates the content of the editor using the selected template. void useTemplate(Event _) { SelectElement templateSelectElement = - document.getElementById('templateSelect'); + document.getElementById('templateSelect'); int selectedIndex = templateSelectElement.selectedIndex; if (selectedIndex == 0) return; @@ -119,4 +114,4 @@ void useTemplate(Event _) { quillEditor.deleteText(0, quillEditor.getLength()); String templateText = _templates[templateSelectElement.selectedIndex - 1]; quillEditor.insertText(0, templateText, 'api'); -} \ No newline at end of file +} diff --git a/dev-workflow/2-final/web/styles.css b/dev-workflow/2-final/web/styles.css index 145148f..67b7674 100644 --- a/dev-workflow/2-final/web/styles.css +++ b/dev-workflow/2-final/web/styles.css @@ -4,7 +4,8 @@ body { } html { - background: #222; + background: url(https://cdn.spacetelescope.org/archives/images/wallpaper2/heic0601a.jpg) no-repeat center center fixed; + background-size: cover; color: white; font-family: 'Jura', sans-serif; } @@ -12,7 +13,7 @@ html { h1.title { font-family: 'Orbitron', sans-serif; font-size: 4em; - margin-top: 0px; + margin: 0em; padding: 0.67em; } @@ -66,11 +67,13 @@ button { background-color: #06c; color: white; border-color: #06c; - border-radius: 5px; + border-radius: 0.25em; font-family: inherit; font-size: 1.1em; - margin: 5px; - padding: 20px; + margin-top: .5em; + margin-left: 0.5em; + margin-bottom: 0.5em; + padding: .5em; } #editor .ql-editor.ql-blank::before { @@ -92,9 +95,10 @@ button { #content { margin-left: 20%; margin-right: 20%; - padding-left: 2%; - padding-right: 2%; - background: rgba(22, 22, 22, 0.8); + padding-left: 20px; + padding-right: 20px; + padding-bottom: 20px; + background: rgba(22, 22, 22, 0.9); background-clip: padding-box; } From 4f47cd6e65a65888db05fc9084ab0bfeae6f7563 Mon Sep 17 00:00:00 2001 From: Shams Zakhour Date: Mon, 17 Oct 2016 08:42:56 -0700 Subject: [PATCH 09/22] Adding a (temp) version. --- dev-workflow/webpage/.analysis_options | 14 + dev-workflow/webpage/.gitignore | 22 + dev-workflow/webpage/pubspec.yaml | 15 + dev-workflow/webpage/web/fonts.css | 95 +++ dev-workflow/webpage/web/index.html | 35 + dev-workflow/webpage/web/main.dart | 117 ++++ dev-workflow/webpage/web/quill.dart | 168 +++++ dev-workflow/webpage/web/quill.snow.css | 883 ++++++++++++++++++++++++ dev-workflow/webpage/web/styles.css | 108 +++ 9 files changed, 1457 insertions(+) create mode 100644 dev-workflow/webpage/.analysis_options create mode 100644 dev-workflow/webpage/.gitignore create mode 100644 dev-workflow/webpage/pubspec.yaml create mode 100644 dev-workflow/webpage/web/fonts.css create mode 100644 dev-workflow/webpage/web/index.html create mode 100644 dev-workflow/webpage/web/main.dart create mode 100644 dev-workflow/webpage/web/quill.dart create mode 100644 dev-workflow/webpage/web/quill.snow.css create mode 100644 dev-workflow/webpage/web/styles.css diff --git a/dev-workflow/webpage/.analysis_options b/dev-workflow/webpage/.analysis_options new file mode 100644 index 0000000..6237a10 --- /dev/null +++ b/dev-workflow/webpage/.analysis_options @@ -0,0 +1,14 @@ +# This file allows you to configure the Dart analyzer. +# +# The commented part below is just for inspiration. Read the guide here: +# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer + + analyzer: + strong-mode: true + exclude: + - web/quill.dart +# linter: +# rules: +# # see catalogue here: http://dart-lang.github.io/linter/lints/ +# - hash_and_equals + diff --git a/dev-workflow/webpage/.gitignore b/dev-workflow/webpage/.gitignore new file mode 100644 index 0000000..04d4ee3 --- /dev/null +++ b/dev-workflow/webpage/.gitignore @@ -0,0 +1,22 @@ +pubspec.lock +.buildlog +.packages +.project +.pub/ + +build/ +**/packages/ +web/gen +web/packages + +doc/api/ + +*.iml +*.ipr +*.iws +.idea/ +.DS_Store + +*.dart.js +*.info.json +*.js diff --git a/dev-workflow/webpage/pubspec.yaml b/dev-workflow/webpage/pubspec.yaml new file mode 100644 index 0000000..2ff75a3 --- /dev/null +++ b/dev-workflow/webpage/pubspec.yaml @@ -0,0 +1,15 @@ +name: captains_log +version: 0.0.1 +description: > + A starship captain's log with a WYSIWYG editor. Uses an existing JavaScript + library with the new Dart JS-interop. + +environment: + sdk: '>=1.17.0 <2.0.0' + +dependencies: + func: ^0.1.0 + js: ^0.6.1 + browser: ^0.10.0 + html: ^0.13.0 + dart_to_js_script_rewriter: ^1.0.1 diff --git a/dev-workflow/webpage/web/fonts.css b/dev-workflow/webpage/web/fonts.css new file mode 100644 index 0000000..404c29a --- /dev/null +++ b/dev-workflow/webpage/web/fonts.css @@ -0,0 +1,95 @@ +/* vietnamese */ +@font-face { + font-family: 'Bungee Hairline'; + font-style: normal; + font-weight: 400; + src: local('Bungee Hairline'), local('BungeeHairline-Regular'), url(https://fonts.gstatic.com/s/bungeehairline/v2/8Li3dr3whdkxuk7pmLaZaVT_xyho_HQDwuvp8oi4gGs.woff2) format('woff2'); + unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; +} +/* latin-ext */ +@font-face { + font-family: 'Bungee Hairline'; + font-style: normal; + font-weight: 400; + src: local('Bungee Hairline'), local('BungeeHairline-Regular'), url(https://fonts.gstatic.com/s/bungeehairline/v2/8Li3dr3whdkxuk7pmLaZae5Tv6dvitgoLnEdohVtlEc.woff2) format('woff2'); + unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; +} +/* latin */ +@font-face { + font-family: 'Bungee Hairline'; + font-style: normal; + font-weight: 400; + src: local('Bungee Hairline'), local('BungeeHairline-Regular'), url(https://fonts.gstatic.com/s/bungeehairline/v2/8Li3dr3whdkxuk7pmLaZaZ16wW5UEL6hOOm3lnIQ28I.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; +} +/* cyrillic-ext */ +@font-face { + font-family: 'Jura'; + font-style: normal; + font-weight: 400; + src: local('Jura Regular'), local('Jura-Regular'), url(https://fonts.gstatic.com/s/jura/v7/peeOujaUvaongbCNNZf9vhTbgVql8nDJpwnrE27mub0.woff2) format('woff2'); + unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; +} +/* cyrillic */ +@font-face { + font-family: 'Jura'; + font-style: normal; + font-weight: 400; + src: local('Jura Regular'), local('Jura-Regular'), url(https://fonts.gstatic.com/s/jura/v7/3RhRLLA8iUiXvCRJ3yKaoRTbgVql8nDJpwnrE27mub0.woff2) format('woff2'); + unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; +} +/* greek */ +@font-face { + font-family: 'Jura'; + font-style: normal; + font-weight: 400; + src: local('Jura Regular'), local('Jura-Regular'), url(https://fonts.gstatic.com/s/jura/v7/o9ZdJ9iClqel-A7qj79PTxTbgVql8nDJpwnrE27mub0.woff2) format('woff2'); + unicode-range: U+0370-03FF; +} +/* latin-ext */ +@font-face { + font-family: 'Jura'; + font-style: normal; + font-weight: 400; + src: local('Jura Regular'), local('Jura-Regular'), url(https://fonts.gstatic.com/s/jura/v7/37n9C5gDFvS63oS93z1vXxTbgVql8nDJpwnrE27mub0.woff2) format('woff2'); + unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; +} +/* latin */ +@font-face { + font-family: 'Jura'; + font-style: normal; + font-weight: 400; + src: local('Jura Regular'), local('Jura-Regular'), url(https://fonts.gstatic.com/s/jura/v7/tz5D0xJo5Gt86C-ZjNRkTfesZW2xOQ-xsNqO47m55DA.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; +} +/* fallback */ +@font-face { + font-family: 'Material Icons'; + font-style: normal; + font-weight: 400; + src: local('Material Icons'), local('MaterialIcons-Regular'), url(https://fonts.gstatic.com/s/materialicons/v18/2fcrYFNaTjcS6g4U3t-Y5UEw0lE80llgEseQY3FEmqw.woff2) format('woff2'); +} +/* latin */ +@font-face { + font-family: 'Orbitron'; + font-style: normal; + font-weight: 400; + src: local('Orbitron-Light'), local('Orbitron-Regular'), url(https://fonts.gstatic.com/s/orbitron/v7/HmnHiRzvcnQr8CjBje6GQnYhjbSpvc47ee6xR_80Hnw.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; +} + +.material-icons { + font-family: 'Material Icons'; + font-weight: normal; + font-style: normal; + font-size: 24px; + line-height: 1; + letter-spacing: normal; + text-transform: none; + display: inline-block; + white-space: nowrap; + word-wrap: normal; + direction: ltr; + -webkit-font-feature-settings: 'liga'; + -webkit-font-smoothing: antialiased; +} diff --git a/dev-workflow/webpage/web/index.html b/dev-workflow/webpage/web/index.html new file mode 100644 index 0000000..be91ead --- /dev/null +++ b/dev-workflow/webpage/web/index.html @@ -0,0 +1,35 @@ + + + + Captain's Log + + + + + + + +
+

Captain's Log

+
+
+
+ +
+ +
+
+
+ + + + + diff --git a/dev-workflow/webpage/web/main.dart b/dev-workflow/webpage/web/main.dart new file mode 100644 index 0000000..b24d88e --- /dev/null +++ b/dev-workflow/webpage/web/main.dart @@ -0,0 +1,117 @@ +import 'dart:html'; + +import 'quill.dart' as quill; + +// ignoring leap years +const int _secondsInAYear = 31536000; +const String _prompt = 'Something happened. Make it sound puzzling and heroic.'; +final List _templates = [ + 'We encountered what appeared to be a . It has ' + 'proven to be sentient and has taken control of our ship. Thus far, all ' + 'efforts at communication have failed...', + 'A warship from the has entered our ' + 'territory. It is currently speeding towards Earth. Thus far, all ' + 'efforts at peace have failed...', + 'The ship has been pulled into a . We are ' + 'observing the universe in the distant . Thus far, all ' + 'efforts to return to our timeline have failed...' +]; + +quill.QuillStatic quillEditor; +Map logEntries; +HtmlElement logElement; + +main() { + // initialization + quillEditor = new quill.QuillStatic('#editor', + new quill.QuillOptionsStatic(theme: 'snow', placeholder: _prompt)); + logElement = document.getElementById('log'); + logEntries = new Map(); + loadPreviousEntries(); + + // listeners + document.getElementById('save').onClick.listen(saveLog); + document.getElementById('templateSelect') as SelectElement + ..onChange.listen(useTemplate); +} + +/// Capture entry in editor, save to local storage and display in log. +void appendToLog(double stardate, HtmlElement logEntryElement) { + logEntries[stardate] = logEntryElement; + window.localStorage[stardate.toString()] = logEntryElement.innerHtml; + displayLogEntry(stardate, logEntryElement); +} + +/// Calculate the current stardate: . +double calculateStardate() { + var now = new DateTime.now(); + var beginningOfYear = new DateTime(now.year); + int secondsThisYear = now.difference(beginningOfYear).inSeconds; + return now.year + secondsThisYear / _secondsInAYear; +} + +/// Copy html elements from the editor view and return them inside a new +/// DivElement. +HtmlElement captureEditorView() { + Element contentElement = document.getElementById('editor').firstChild; + + var logEntryElement = new DivElement()..innerHtml = contentElement.innerHtml; + + return logEntryElement; +} + +/// Update the dom with the provided log entry. +void displayLogEntry(double stardate, HtmlElement logEntryElement) { + if (logElement.children.isNotEmpty) { + logElement.insertAdjacentElement('afterBegin', new HRElement()); + } + + logElement.insertAdjacentElement('afterBegin', logEntryElement); + var stardateElement = new HeadingElement.h2() + ..text = 'Stardate: $stardate' + ..classes.add('stardate'); + logElement.insertAdjacentElement('afterBegin', stardateElement); +} + +/// Load all log entries from browser local storage. +void loadPreviousEntries() { + List keys = window.localStorage.keys.toList(); + keys.sort(); + for (String key in keys) { + var entryElement = new DivElement()..innerHtml = window.localStorage[key]; + logEntries[double.parse(key)] = entryElement; + } + updateDisplay(); +} + +/// Save the log entry that is currently in the editor. +void saveLog(Event _) { + DivElement logEntryElement = captureEditorView(); + appendToLog(calculateStardate(), logEntryElement); + + // Clear the editor. + quillEditor.deleteText(0, quillEditor.getLength()); +} + +/// Update the dom to show all current log entries. +void updateDisplay() { + logElement.innerHtml = ''; + List starDates = logEntries.keys.toList(); + starDates.sort(); + for (double starDate in starDates) { + displayLogEntry(starDate, logEntries[starDate]); + } +} + +/// Updates the content of the editor using the selected template. +void useTemplate(Event _) { + SelectElement templateSelectElement = + document.getElementById('templateSelect'); + int selectedIndex = templateSelectElement.selectedIndex; + + if (selectedIndex == 0) return; + + quillEditor.deleteText(0, quillEditor.getLength()); + String templateText = _templates[templateSelectElement.selectedIndex - 1]; + quillEditor.insertText(0, templateText, 'api'); +} diff --git a/dev-workflow/webpage/web/quill.dart b/dev-workflow/webpage/web/quill.dart new file mode 100644 index 0000000..c0c6dcc --- /dev/null +++ b/dev-workflow/webpage/web/quill.dart @@ -0,0 +1,168 @@ +// This version is autogenerated and contains some other small polish tweaks. For example see +// how String /*'api'|'user'|'silent'*/ source is handled. + +@JS() +library quill; + +import "package:js/js.dart"; +import "package:func/func.dart"; + +/// Type definitions for Quill v1.0.3 +/// Project: http://quilljs.com +/// Definitions by: Sumit +/// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// Module QuillJS +@anonymous +@JS() +abstract class QuillOptionsStatic { + external String get debug; + external set debug(String v); + external dynamic /*JSMap of */ get modules; + external set modules(dynamic /*JSMap of */ v); + external String get placeholder; + external set placeholder(String v); + external bool get readOnly; + external set readOnly(bool v); + external String get theme; + external set theme(String v); + external factory QuillOptionsStatic( + {String debug, + dynamic /*JSMap of */ modules, + String placeholder, + bool readOnly, + String theme}); +} + +@anonymous +@JS() +abstract class BoundsStatic { + external num get left; + external set left(num v); + external num get top; + external set top(num v); + external num get height; + external set height(num v); + external num get width; + external set width(num v); + external factory BoundsStatic({num left, num top, num height, num width}); +} + +@anonymous +@JS() +abstract class DeltaStatic { + external List get ops; + external set ops(List v); + external dynamic get retain; + external set retain(dynamic v); + external dynamic get delete; + external set delete(dynamic v); + external dynamic get insert; + external set insert(dynamic v); + external dynamic get attributes; + external set attributes(dynamic v); + external factory DeltaStatic( + {List ops, + dynamic retain, + dynamic delete, + dynamic insert, + dynamic attributes}); +} + +@anonymous +@JS() +abstract class RangeStatic { + external factory RangeStatic(); + external num get index; + external set index(num v); + external num get length; + external set length(num v); +} + +@JS("Quill") +abstract class QuillStatic { + external factory QuillStatic(String selector, [QuillOptionsStatic options]); + external void deleteText(num start, num end, + [String /*'api'|'user'|'silent'*/ source]); + external void disable(); + external void enable([bool enabled]); + external DeltaStatic getContents([num start, num end]); + external num getLength(); + external String getText([num start, num end]); + external void insertEmbed(num index, String type, String url, + [String /*'api'|'user'|'silent'*/ source]); + /*external void insertText(num index, String text, ['api'|'user'|'silent' source]);*/ + /*external void insertText(num index, String text, String format, String value, ['api'|'user'|'silent' source]);*/ + /*external void insertText(num index, String text, JSMap of formats, ['api'|'user'|'silent' source]);*/ + external void insertText(num index, String text, + [dynamic /*'api'|'user'|'silent'|String|JSMap of */ source_format_formats, + String /*String|'api'|'user'|'silent'*/ value_source, + String /*'api'|'user'|'silent'*/ source]); + /*external String pasteHTML(num index, String html, ['api'|'user'|'silent' source]);*/ + /*external String pasteHTML(String html, ['api'|'user'|'silent' source]);*/ + external String pasteHTML(dynamic /*num|String*/ index_html, + [String /*String|'api'|'user'|'silent'*/ html_source, + String /*'api'|'user'|'silent'*/ source]); + external void setContents(DeltaStatic delta, + [String /*'api'|'user'|'silent'*/ source]); + external void setText(String text, [String /*'api'|'user'|'silent'*/ source]); + external void update([String source]); + external void updateContents(DeltaStatic delta, + [String /*'api'|'user'|'silent'*/ source]); + external void format(String name, dynamic value, + [String /*'api'|'user'|'silent'*/ source]); + /*external void formatLine(num index, num length, ['api'|'user'|'silent' source]);*/ + /*external void formatLine(num index, num length, String format, dynamic value, ['api'|'user'|'silent' source]);*/ + /*external void formatLine(num index, num length, JSMap of formats, ['api'|'user'|'silent' source]);*/ + external void formatLine(num index, num length, + [dynamic /*'api'|'user'|'silent'|String|JSMap of */ source_format_formats, + dynamic /*dynamic|'api'|'user'|'silent'*/ value_source, + String /*'api'|'user'|'silent'*/ source]); + /*external void formatText(num index, num length, ['api'|'user'|'silent' source]);*/ + /*external void formatText(num index, num length, String format, dynamic value, ['api'|'user'|'silent' source]);*/ + /*external void formatText(num index, num length, JSMap of formats, ['api'|'user'|'silent' source]);*/ + external void formatText(num index, num length, + [dynamic /*'api'|'user'|'silent'|String|JSMap of */ source_format_formats, + dynamic /*dynamic|'api'|'user'|'silent'*/ value_source, + String /*'api'|'user'|'silent'*/ source]); + /*external JSMap of getFormat([RangeStatic range]);*/ + /*external JSMap of getFormat(num index, [num length]);*/ + external dynamic /*JSMap of */ getFormat( + [dynamic /*RangeStatic|num*/ range_index, num length]); + external void removeFormat(num index, num length, + [String /*'api'|'user'|'silent'*/ source]); + external void blur(); + external void focus(); + external BoundsStatic getBounds(num index, [num length]); + external RangeStatic getSelection([bool focus]); + external bool hasFocus(); + /*external void setSelection(num index, num length, ['api'|'user'|'silent' source]);*/ + /*external void setSelection(RangeStatic range, ['api'|'user'|'silent' source]);*/ + external void setSelection(dynamic /*num|RangeStatic*/ index_range, + [dynamic /*num|'api'|'user'|'silent'*/ length_source, + String /*'api'|'user'|'silent'*/ source]); + external QuillStatic on(String eventName, + dynamic /*VoidFunc3|(name: string, ...args: any[]) => void*/ callback); + external QuillStatic once( + String eventName, void callback(DeltaStatic delta, String source)); + external QuillStatic off( + String eventName, void callback(DeltaStatic delta, String source)); + external void debug(String level); + external dynamic JS$import(String path); + /*external void register(String path, dynamic def, [bool suppressWarning]);*/ + /*external void register(JSMap of defs, [bool suppressWarning]);*/ + external void register(dynamic /*String|JSMap of */ path_defs, + [dynamic /*dynamic|bool*/ def_suppressWarning, bool suppressWarning]); + external dynamic addContainer(String className, [dynamic refNode]); + external dynamic getModule(String name); +} + +// End module QuillJS +@JS("Quill") +external QuillStatic get Quill; +@JS("Quill") +external set Quill(QuillStatic v); +// Module Quill +/* WARNING: export assignment not yet supported. */ + +// End module Quill \ No newline at end of file diff --git a/dev-workflow/webpage/web/quill.snow.css b/dev-workflow/webpage/web/quill.snow.css new file mode 100644 index 0000000..efc002b --- /dev/null +++ b/dev-workflow/webpage/web/quill.snow.css @@ -0,0 +1,883 @@ +/*! + * Quill Editor v1.0.4 + * https://quilljs.com/ + * Copyright (c) 2014, Jason Chen + * Copyright (c) 2013, salesforce.com + */ +.ql-container { + box-sizing: border-box; + font-family: Helvetica, Arial, sans-serif; + font-size: 13px; + height: 100%; + margin: 0px; + position: relative; +} +.ql-clipboard { + left: -100000px; + height: 1px; + overflow-y: hidden; + position: absolute; + top: 50%; +} +.ql-clipboard p { + margin: 0; + padding: 0; +} +.ql-editor { + box-sizing: border-box; + cursor: text; + line-height: 1.42; + height: 100%; + outline: none; + overflow-y: auto; + padding: 12px 15px; + tab-size: 4; + -moz-tab-size: 4; + text-align: left; + white-space: pre-wrap; + word-wrap: break-word; +} +.ql-editor p, +.ql-editor ol, +.ql-editor ul, +.ql-editor pre, +.ql-editor blockquote, +.ql-editor h1, +.ql-editor h2, +.ql-editor h3, +.ql-editor h4, +.ql-editor h5, +.ql-editor h6 { + margin: 0; + padding: 0; + counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9; +} +.ql-editor ol, +.ql-editor ul { + padding-left: 1.5em; +} +.ql-editor ol > li, +.ql-editor ul > li { + list-style-type: none; +} +.ql-editor ul > li::before { + content: '\25CF'; +} +.ql-editor li::before { + display: inline-block; + margin-right: 0.3em; + text-align: right; + white-space: nowrap; + width: 1.2em; +} +.ql-editor li:not(.ql-direction-rtl)::before { + margin-left: -1.5em; +} +.ql-editor ol li, +.ql-editor ul li { + padding-left: 1.5em; +} +.ql-editor ol li { + counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9; + counter-increment: list-num; +} +.ql-editor ol li:before { + content: counter(list-num, decimal) '. '; +} +.ql-editor ol li.ql-indent-1 { + counter-increment: list-1; +} +.ql-editor ol li.ql-indent-1:before { + content: counter(list-1, lower-alpha) '. '; +} +.ql-editor ol li.ql-indent-1 { + counter-reset: list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9; +} +.ql-editor ol li.ql-indent-2 { + counter-increment: list-2; +} +.ql-editor ol li.ql-indent-2:before { + content: counter(list-2, lower-roman) '. '; +} +.ql-editor ol li.ql-indent-2 { + counter-reset: list-3 list-4 list-5 list-6 list-7 list-8 list-9; +} +.ql-editor ol li.ql-indent-3 { + counter-increment: list-3; +} +.ql-editor ol li.ql-indent-3:before { + content: counter(list-3, decimal) '. '; +} +.ql-editor ol li.ql-indent-3 { + counter-reset: list-4 list-5 list-6 list-7 list-8 list-9; +} +.ql-editor ol li.ql-indent-4 { + counter-increment: list-4; +} +.ql-editor ol li.ql-indent-4:before { + content: counter(list-4, lower-alpha) '. '; +} +.ql-editor ol li.ql-indent-4 { + counter-reset: list-5 list-6 list-7 list-8 list-9; +} +.ql-editor ol li.ql-indent-5 { + counter-increment: list-5; +} +.ql-editor ol li.ql-indent-5:before { + content: counter(list-5, lower-roman) '. '; +} +.ql-editor ol li.ql-indent-5 { + counter-reset: list-6 list-7 list-8 list-9; +} +.ql-editor ol li.ql-indent-6 { + counter-increment: list-6; +} +.ql-editor ol li.ql-indent-6:before { + content: counter(list-6, decimal) '. '; +} +.ql-editor ol li.ql-indent-6 { + counter-reset: list-7 list-8 list-9; +} +.ql-editor ol li.ql-indent-7 { + counter-increment: list-7; +} +.ql-editor ol li.ql-indent-7:before { + content: counter(list-7, lower-alpha) '. '; +} +.ql-editor ol li.ql-indent-7 { + counter-reset: list-8 list-9; +} +.ql-editor ol li.ql-indent-8 { + counter-increment: list-8; +} +.ql-editor ol li.ql-indent-8:before { + content: counter(list-8, lower-roman) '. '; +} +.ql-editor ol li.ql-indent-8 { + counter-reset: list-9; +} +.ql-editor ol li.ql-indent-9 { + counter-increment: list-9; +} +.ql-editor ol li.ql-indent-9:before { + content: counter(list-9, decimal) '. '; +} +.ql-editor .ql-indent-1:not(.ql-direction-rtl) { + padding-left: 3em; +} +.ql-editor li.ql-indent-1:not(.ql-direction-rtl) { + padding-left: 4.5em; +} +.ql-editor .ql-indent-1.ql-direction-rtl.ql-align-right { + padding-right: 3em; +} +.ql-editor li.ql-indent-1.ql-direction-rtl.ql-align-right { + padding-right: 4.5em; +} +.ql-editor .ql-indent-2:not(.ql-direction-rtl) { + padding-left: 6em; +} +.ql-editor li.ql-indent-2:not(.ql-direction-rtl) { + padding-left: 7.5em; +} +.ql-editor .ql-indent-2.ql-direction-rtl.ql-align-right { + padding-right: 6em; +} +.ql-editor li.ql-indent-2.ql-direction-rtl.ql-align-right { + padding-right: 7.5em; +} +.ql-editor .ql-indent-3:not(.ql-direction-rtl) { + padding-left: 9em; +} +.ql-editor li.ql-indent-3:not(.ql-direction-rtl) { + padding-left: 10.5em; +} +.ql-editor .ql-indent-3.ql-direction-rtl.ql-align-right { + padding-right: 9em; +} +.ql-editor li.ql-indent-3.ql-direction-rtl.ql-align-right { + padding-right: 10.5em; +} +.ql-editor .ql-indent-4:not(.ql-direction-rtl) { + padding-left: 12em; +} +.ql-editor li.ql-indent-4:not(.ql-direction-rtl) { + padding-left: 13.5em; +} +.ql-editor .ql-indent-4.ql-direction-rtl.ql-align-right { + padding-right: 12em; +} +.ql-editor li.ql-indent-4.ql-direction-rtl.ql-align-right { + padding-right: 13.5em; +} +.ql-editor .ql-indent-5:not(.ql-direction-rtl) { + padding-left: 15em; +} +.ql-editor li.ql-indent-5:not(.ql-direction-rtl) { + padding-left: 16.5em; +} +.ql-editor .ql-indent-5.ql-direction-rtl.ql-align-right { + padding-right: 15em; +} +.ql-editor li.ql-indent-5.ql-direction-rtl.ql-align-right { + padding-right: 16.5em; +} +.ql-editor .ql-indent-6:not(.ql-direction-rtl) { + padding-left: 18em; +} +.ql-editor li.ql-indent-6:not(.ql-direction-rtl) { + padding-left: 19.5em; +} +.ql-editor .ql-indent-6.ql-direction-rtl.ql-align-right { + padding-right: 18em; +} +.ql-editor li.ql-indent-6.ql-direction-rtl.ql-align-right { + padding-right: 19.5em; +} +.ql-editor .ql-indent-7:not(.ql-direction-rtl) { + padding-left: 21em; +} +.ql-editor li.ql-indent-7:not(.ql-direction-rtl) { + padding-left: 22.5em; +} +.ql-editor .ql-indent-7.ql-direction-rtl.ql-align-right { + padding-right: 21em; +} +.ql-editor li.ql-indent-7.ql-direction-rtl.ql-align-right { + padding-right: 22.5em; +} +.ql-editor .ql-indent-8:not(.ql-direction-rtl) { + padding-left: 24em; +} +.ql-editor li.ql-indent-8:not(.ql-direction-rtl) { + padding-left: 25.5em; +} +.ql-editor .ql-indent-8.ql-direction-rtl.ql-align-right { + padding-right: 24em; +} +.ql-editor li.ql-indent-8.ql-direction-rtl.ql-align-right { + padding-right: 25.5em; +} +.ql-editor .ql-indent-9:not(.ql-direction-rtl) { + padding-left: 27em; +} +.ql-editor li.ql-indent-9:not(.ql-direction-rtl) { + padding-left: 28.5em; +} +.ql-editor .ql-indent-9.ql-direction-rtl.ql-align-right { + padding-right: 27em; +} +.ql-editor li.ql-indent-9.ql-direction-rtl.ql-align-right { + padding-right: 28.5em; +} +.ql-editor .ql-video { + display: block; + max-width: 100%; +} +.ql-editor .ql-video.ql-align-center { + margin: 0 auto; +} +.ql-editor .ql-video.ql-align-right { + margin: 0 0 0 auto; +} +.ql-editor .ql-bg-black { + background-color: #000; +} +.ql-editor .ql-bg-red { + background-color: #e60000; +} +.ql-editor .ql-bg-orange { + background-color: #f90; +} +.ql-editor .ql-bg-yellow { + background-color: #ff0; +} +.ql-editor .ql-bg-green { + background-color: #008a00; +} +.ql-editor .ql-bg-blue { + background-color: #06c; +} +.ql-editor .ql-bg-purple { + background-color: #93f; +} +.ql-editor .ql-color-white { + color: #fff; +} +.ql-editor .ql-color-red { + color: #e60000; +} +.ql-editor .ql-color-orange { + color: #f90; +} +.ql-editor .ql-color-yellow { + color: #ff0; +} +.ql-editor .ql-color-green { + color: #008a00; +} +.ql-editor .ql-color-blue { + color: #06c; +} +.ql-editor .ql-color-purple { + color: #93f; +} +.ql-editor .ql-font-serif { + font-family: Georgia, Times New Roman, serif; +} +.ql-editor .ql-font-monospace { + font-family: Monaco, Courier New, monospace; +} +.ql-editor .ql-size-small { + font-size: 0.75em; +} +.ql-editor .ql-size-large { + font-size: 1.5em; +} +.ql-editor .ql-size-huge { + font-size: 2.5em; +} +.ql-editor .ql-direction-rtl { + direction: rtl; + text-align: inherit; +} +.ql-editor .ql-align-center { + text-align: center; +} +.ql-editor .ql-align-justify { + text-align: justify; +} +.ql-editor .ql-align-right { + text-align: right; +} +.ql-editor.ql-blank::before { + color: rgba(0,0,0,0.6); + content: attr(data-placeholder); + font-style: italic; + pointer-events: none; + position: absolute; +} +.ql-snow.ql-toolbar:after, +.ql-snow .ql-toolbar:after { + clear: both; + content: ''; + display: table; +} +.ql-snow.ql-toolbar button, +.ql-snow .ql-toolbar button { + background: none; + border: none; + cursor: pointer; + display: inline-block; + float: left; + height: 24px; + outline: none; + padding: 3px 5px; + width: 28px; +} +.ql-snow.ql-toolbar button svg, +.ql-snow .ql-toolbar button svg { + float: left; + height: 100%; +} +.ql-snow.ql-toolbar input.ql-image[type=file], +.ql-snow .ql-toolbar input.ql-image[type=file] { + display: none; +} +.ql-snow.ql-toolbar button:hover, +.ql-snow .ql-toolbar button:hover, +.ql-snow.ql-toolbar button.ql-active, +.ql-snow .ql-toolbar button.ql-active, +.ql-snow.ql-toolbar .ql-picker-label:hover, +.ql-snow .ql-toolbar .ql-picker-label:hover, +.ql-snow.ql-toolbar .ql-picker-label.ql-active, +.ql-snow .ql-toolbar .ql-picker-label.ql-active, +.ql-snow.ql-toolbar .ql-picker-item:hover, +.ql-snow .ql-toolbar .ql-picker-item:hover, +.ql-snow.ql-toolbar .ql-picker-item.ql-selected, +.ql-snow .ql-toolbar .ql-picker-item.ql-selected { + color: #06c; +} +.ql-snow.ql-toolbar button:hover .ql-fill, +.ql-snow .ql-toolbar button:hover .ql-fill, +.ql-snow.ql-toolbar button.ql-active .ql-fill, +.ql-snow .ql-toolbar button.ql-active .ql-fill, +.ql-snow.ql-toolbar .ql-picker-label:hover .ql-fill, +.ql-snow .ql-toolbar .ql-picker-label:hover .ql-fill, +.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-fill, +.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-fill, +.ql-snow.ql-toolbar .ql-picker-item:hover .ql-fill, +.ql-snow .ql-toolbar .ql-picker-item:hover .ql-fill, +.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-fill, +.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-fill, +.ql-snow.ql-toolbar button:hover .ql-stroke.ql-fill, +.ql-snow .ql-toolbar button:hover .ql-stroke.ql-fill, +.ql-snow.ql-toolbar button.ql-active .ql-stroke.ql-fill, +.ql-snow .ql-toolbar button.ql-active .ql-stroke.ql-fill, +.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke.ql-fill, +.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke.ql-fill, +.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke.ql-fill, +.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke.ql-fill, +.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke.ql-fill, +.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke.ql-fill, +.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill, +.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill { + fill: #06c; +} +.ql-snow.ql-toolbar button:hover .ql-stroke, +.ql-snow .ql-toolbar button:hover .ql-stroke, +.ql-snow.ql-toolbar button.ql-active .ql-stroke, +.ql-snow .ql-toolbar button.ql-active .ql-stroke, +.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke, +.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke, +.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke, +.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke, +.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke, +.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke, +.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke, +.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke, +.ql-snow.ql-toolbar button:hover .ql-stroke-mitter, +.ql-snow .ql-toolbar button:hover .ql-stroke-mitter, +.ql-snow.ql-toolbar button.ql-active .ql-stroke-mitter, +.ql-snow .ql-toolbar button.ql-active .ql-stroke-mitter, +.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke-mitter, +.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke-mitter, +.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke-mitter, +.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke-mitter, +.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke-mitter, +.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke-mitter, +.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke-mitter, +.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke-mitter { + stroke: #06c; +} +.ql-snow { + box-sizing: border-box; +} +.ql-snow * { + box-sizing: border-box; +} +.ql-snow .ql-hidden { + display: none; +} +.ql-snow .ql-out-bottom, +.ql-snow .ql-out-top { + visibility: hidden; +} +.ql-snow .ql-tooltip { + position: absolute; +} +.ql-snow .ql-tooltip a { + cursor: pointer; + text-decoration: none; +} +.ql-snow .ql-formats { + display: inline-block; + vertical-align: middle; +} +.ql-snow .ql-formats:after { + clear: both; + content: ''; + display: table; +} +.ql-snow .ql-toolbar.snow, +.ql-snow .ql-stroke { + fill: none; + stroke: #444; + stroke-linecap: round; + stroke-linejoin: round; + stroke-width: 2; +} +.ql-snow .ql-stroke-mitter { + fill: none; + stroke: #444; + stroke-mitterlimit: 10; + stroke-width: 2; +} +.ql-snow .ql-fill, +.ql-snow .ql-stroke.ql-fill { + fill: #444; +} +.ql-snow .ql-empty { + fill: none; +} +.ql-snow .ql-even { + fill-rule: evenodd; +} +.ql-snow .ql-thin, +.ql-snow .ql-stroke.ql-thin { + stroke-width: 1; +} +.ql-snow .ql-transparent { + opacity: 0.4; +} +.ql-snow .ql-direction svg:last-child { + display: none; +} +.ql-snow .ql-direction.ql-active svg:last-child { + display: inline; +} +.ql-snow .ql-direction.ql-active svg:first-child { + display: none; +} +.ql-snow .ql-editor h1 { + font-size: 2em; +} +.ql-snow .ql-editor h2 { + font-size: 1.5em; +} +.ql-snow .ql-editor h3 { + font-size: 1.17em; +} +.ql-snow .ql-editor h4 { + font-size: 1em; +} +.ql-snow .ql-editor h5 { + font-size: 0.83em; +} +.ql-snow .ql-editor h6 { + font-size: 0.67em; +} +.ql-snow .ql-editor a { + text-decoration: underline; +} +.ql-snow .ql-editor blockquote { + border-left: 4px solid #ccc; + margin-bottom: 5px; + margin-top: 5px; + padding-left: 16px; +} +.ql-snow .ql-editor code, +.ql-snow .ql-editor pre { + background-color: #f0f0f0; + border-radius: 3px; +} +.ql-snow .ql-editor pre { + white-space: pre-wrap; + margin-bottom: 5px; + margin-top: 5px; + padding: 5px 10px; +} +.ql-snow .ql-editor code { + font-size: 85%; + padding-bottom: 2px; + padding-top: 2px; +} +.ql-snow .ql-editor code:before, +.ql-snow .ql-editor code:after { + content: "\A0"; + letter-spacing: -2px; +} +.ql-snow .ql-editor pre.ql-syntax { + background-color: #23241f; + color: #f8f8f2; + overflow: visible; +} +.ql-snow .ql-editor img { + max-width: 100%; +} +.ql-snow .ql-picker { + color: #444; + display: inline-block; + float: left; + font-size: 14px; + font-weight: 500; + height: 24px; + position: relative; + vertical-align: middle; +} +.ql-snow .ql-picker-label { + cursor: pointer; + display: inline-block; + height: 100%; + padding-left: 8px; + padding-right: 2px; + position: relative; + width: 100%; +} +.ql-snow .ql-picker-label::before { + display: inline-block; + line-height: 22px; +} +.ql-snow .ql-picker-options { + background-color: #fff; + display: none; + min-width: 100%; + padding: 4px 8px; + position: absolute; + white-space: nowrap; +} +.ql-snow .ql-picker-options .ql-picker-item { + cursor: pointer; + display: block; + padding-bottom: 5px; + padding-top: 5px; +} +.ql-snow .ql-picker.ql-expanded .ql-picker-label { + color: #ccc; + z-index: 2; +} +.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-fill { + fill: #ccc; +} +.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-stroke { + stroke: #ccc; +} +.ql-snow .ql-picker.ql-expanded .ql-picker-options { + display: block; + margin-top: -1px; + top: 100%; + z-index: 1; +} +.ql-snow .ql-color-picker, +.ql-snow .ql-icon-picker { + width: 28px; +} +.ql-snow .ql-color-picker .ql-picker-label, +.ql-snow .ql-icon-picker .ql-picker-label { + padding: 2px 4px; +} +.ql-snow .ql-color-picker .ql-picker-label svg, +.ql-snow .ql-icon-picker .ql-picker-label svg { + right: 4px; +} +.ql-snow .ql-icon-picker .ql-picker-options { + padding: 4px 0px; +} +.ql-snow .ql-icon-picker .ql-picker-item { + height: 24px; + width: 24px; + padding: 2px 4px; +} +.ql-snow .ql-color-picker .ql-picker-options { + padding: 3px 5px; + width: 152px; +} +.ql-snow .ql-color-picker .ql-picker-item { + border: 1px solid transparent; + float: left; + height: 16px; + margin: 2px; + padding: 0px; + width: 16px; +} +.ql-snow .ql-color-picker .ql-picker-item.ql-primary-color { + margin-bottom: toolbarPadding; +} +.ql-snow .ql-picker:not(.ql-color-picker):not(.ql-icon-picker) svg { + position: absolute; + margin-top: -9px; + right: 0; + top: 50%; + width: 18px; +} +.ql-snow .ql-picker.ql-header .ql-picker-label[data-label]:not([data-label=''])::before, +.ql-snow .ql-picker.ql-font .ql-picker-label[data-label]:not([data-label=''])::before, +.ql-snow .ql-picker.ql-size .ql-picker-label[data-label]:not([data-label=''])::before, +.ql-snow .ql-picker.ql-header .ql-picker-item[data-label]:not([data-label=''])::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-label]:not([data-label=''])::before, +.ql-snow .ql-picker.ql-size .ql-picker-item[data-label]:not([data-label=''])::before { + content: attr(data-label); +} +.ql-snow .ql-picker.ql-header { + width: 98px; +} +.ql-snow .ql-picker.ql-header .ql-picker-label::before, +.ql-snow .ql-picker.ql-header .ql-picker-item::before { + content: 'Normal'; +} +.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="1"]::before, +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]::before { + content: 'Heading 1'; +} +.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before, +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before { + content: 'Heading 2'; +} +.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before, +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before { + content: 'Heading 3'; +} +.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="4"]::before, +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]::before { + content: 'Heading 4'; +} +.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="5"]::before, +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="5"]::before { + content: 'Heading 5'; +} +.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="6"]::before, +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="6"]::before { + content: 'Heading 6'; +} +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]::before { + font-size: 2em; +} +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before { + font-size: 1.5em; +} +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before { + font-size: 1.17em; +} +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]::before { + font-size: 1em; +} +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="5"]::before { + font-size: 0.83em; +} +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="6"]::before { + font-size: 0.67em; +} +.ql-snow .ql-picker.ql-font { + width: 108px; +} +.ql-snow .ql-picker.ql-font .ql-picker-label::before, +.ql-snow .ql-picker.ql-font .ql-picker-item::before { + content: 'Sans Serif'; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=serif]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=serif]::before { + content: 'Serif'; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=monospace]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=monospace]::before { + content: 'Monospace'; +} +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=serif]::before { + font-family: Georgia, Times New Roman, serif; +} +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=monospace]::before { + font-family: Monaco, Courier New, monospace; +} +.ql-snow .ql-picker.ql-size { + width: 98px; +} +.ql-snow .ql-picker.ql-size .ql-picker-label::before, +.ql-snow .ql-picker.ql-size .ql-picker-item::before { + content: 'Normal'; +} +.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=small]::before, +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=small]::before { + content: 'Small'; +} +.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=large]::before, +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=large]::before { + content: 'Large'; +} +.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=huge]::before, +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=huge]::before { + content: 'Huge'; +} +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=small]::before { + font-size: 10px; +} +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=large]::before { + font-size: 18px; +} +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=huge]::before { + font-size: 32px; +} +.ql-snow .ql-color-picker.ql-background .ql-picker-item { + background-color: #fff; +} +.ql-snow .ql-color-picker.ql-color .ql-picker-item { + background-color: #000; +} +.ql-toolbar.ql-snow { + border: 1px solid #ccc; + box-sizing: border-box; + font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif; + padding: 8px; +} +.ql-toolbar.ql-snow .ql-formats { + margin-right: 15px; +} +.ql-toolbar.ql-snow .ql-picker-label { + border: 1px solid transparent; +} +.ql-toolbar.ql-snow .ql-picker-options { + border: 1px solid transparent; + box-shadow: rgba(0,0,0,0.2) 0 2px 8px; +} +.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-label { + border-color: #ccc; +} +.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options { + border-color: #ccc; +} +.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item.ql-selected, +.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item:hover { + border-color: #000; +} +.ql-toolbar.ql-snow + .ql-container.ql-snow { + border-top: 0px; +} +.ql-snow .ql-tooltip { + background-color: #fff; + border: 1px solid #ccc; + box-shadow: 0px 0px 5px #ddd; + color: #444; + margin-top: 10px; + padding: 5px 12px; + white-space: nowrap; +} +.ql-snow .ql-tooltip::before { + content: "Visit URL:"; + line-height: 26px; + margin-right: 8px; +} +.ql-snow .ql-tooltip input[type=text] { + display: none; + border: 1px solid #ccc; + font-size: 13px; + height: 26px; + margin: 0px; + padding: 3px 5px; + width: 170px; +} +.ql-snow .ql-tooltip a.ql-preview { + display: inline-block; + max-width: 200px; + overflow-x: hidden; + text-overflow: ellipsis; + vertical-align: top; +} +.ql-snow .ql-tooltip a.ql-action::after { + border-right: 1px solid #ccc; + content: 'Edit'; + margin-left: 16px; + padding-right: 8px; +} +.ql-snow .ql-tooltip a.ql-remove::before { + content: 'Remove'; + margin-left: 8px; +} +.ql-snow .ql-tooltip a { + line-height: 26px; +} +.ql-snow .ql-tooltip.ql-editing a.ql-preview, +.ql-snow .ql-tooltip.ql-editing a.ql-remove { + display: none; +} +.ql-snow .ql-tooltip.ql-editing input[type=text] { + display: inline-block; +} +.ql-snow .ql-tooltip.ql-editing a.ql-action::after { + border-right: 0px; + content: 'Save'; + padding-right: 0px; +} +.ql-snow .ql-tooltip[data-mode=link]::before { + content: "Enter link:"; +} +.ql-snow .ql-tooltip[data-mode=formula]::before { + content: "Enter formula:"; +} +.ql-snow .ql-tooltip[data-mode=video]::before { + content: "Enter video:"; +} +.ql-snow a { + color: #06c; +} +.ql-container.ql-snow { + border: 1px solid #ccc; +} diff --git a/dev-workflow/webpage/web/styles.css b/dev-workflow/webpage/web/styles.css new file mode 100644 index 0000000..67b7674 --- /dev/null +++ b/dev-workflow/webpage/web/styles.css @@ -0,0 +1,108 @@ +body { + padding: 0em; + margin: 0em; +} + +html { + background: url(https://cdn.spacetelescope.org/archives/images/wallpaper2/heic0601a.jpg) no-repeat center center fixed; + background-size: cover; + color: white; + font-family: 'Jura', sans-serif; +} + +h1.title { + font-family: 'Orbitron', sans-serif; + font-size: 4em; + margin: 0em; + padding: 0.67em; +} + +h2.stardate { + font-family: 'Bungee Hairline', cursive; +} + +.buttons { + display: flex; + justify-content: space-between; + align-items: center; +} + +select { + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; + background-color: #222; + border: none; + color: inherit; + font-size: inherit; + padding: 5px; + padding-right: 18px; +} + +select:focus { + outline: none; +} + +select:active { + background-color: #222; +} + +div.select { + border-bottom: 1px solid gray; + display: inline-block; + height: 100%; + position: relative; +} + +div.select::after { + font-family: 'Material Icons'; + content: '\E5C5'; + position: absolute; + right: 2px; + top: 6px; + pointer-events: none; +} + +button { + background-color: #06c; + color: white; + border-color: #06c; + border-radius: 0.25em; + font-family: inherit; + font-size: 1.1em; + margin-top: .5em; + margin-left: 0.5em; + margin-bottom: 0.5em; + padding: .5em; +} + +#editor .ql-editor.ql-blank::before { + color: white; +} + +.ql-toolbar .ql-stroke { + stroke: white; +} + +.ql-toolbar .ql-fill { + fill: white; +} + +.ql-toolbar.ql-snow .ql-picker-label { + color: white; +} + +#content { + margin-left: 20%; + margin-right: 20%; + padding-left: 20px; + padding-right: 20px; + padding-bottom: 20px; + background: rgba(22, 22, 22, 0.9); + background-clip: padding-box; +} + +#editor { + height: 20em; + font-size: 1.1em; +} From 3757bdd0ba599b976234d6937b90f7bacf82579d Mon Sep 17 00:00:00 2001 From: Shams Zakhour Date: Mon, 17 Oct 2016 09:43:24 -0700 Subject: [PATCH 10/22] Making the paths to the executables absolute for webdev.dartlang. --- dev-workflow/webpage/web/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-workflow/webpage/web/index.html b/dev-workflow/webpage/web/index.html index be91ead..dadabe7 100644 --- a/dev-workflow/webpage/web/index.html +++ b/dev-workflow/webpage/web/index.html @@ -30,6 +30,6 @@

Captain's Log

- + From 8b9d1e0bb81dc32544116dab6d7ed1204ce475cf Mon Sep 17 00:00:00 2001 From: Shams Zakhour Date: Mon, 17 Oct 2016 09:58:32 -0700 Subject: [PATCH 11/22] Tweaking the size of the title. --- dev-workflow/webpage/web/styles.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-workflow/webpage/web/styles.css b/dev-workflow/webpage/web/styles.css index 67b7674..8223bd9 100644 --- a/dev-workflow/webpage/web/styles.css +++ b/dev-workflow/webpage/web/styles.css @@ -12,7 +12,7 @@ html { h1.title { font-family: 'Orbitron', sans-serif; - font-size: 4em; + font-size: 3em; margin: 0em; padding: 0.67em; } From cc0b69c4c812bbc22c2612dfe2df86a038f75f59 Mon Sep 17 00:00:00 2001 From: Shams Zakhour Date: Tue, 18 Oct 2016 11:13:00 -0700 Subject: [PATCH 12/22] I've regenerated the quill.dart file and am using that. --- dev-workflow/2-final/web/quill.dart | 51 ++++++++++++++++------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/dev-workflow/2-final/web/quill.dart b/dev-workflow/2-final/web/quill.dart index c0c6dcc..3f41212 100644 --- a/dev-workflow/2-final/web/quill.dart +++ b/dev-workflow/2-final/web/quill.dart @@ -1,10 +1,8 @@ -// This version is autogenerated and contains some other small polish tweaks. For example see -// how String /*'api'|'user'|'silent'*/ source is handled. - @JS() library quill; import "package:js/js.dart"; +import "dart:html" show Element; import "package:func/func.dart"; /// Type definitions for Quill v1.0.3 @@ -72,16 +70,25 @@ abstract class DeltaStatic { @anonymous @JS() abstract class RangeStatic { - external factory RangeStatic(); + // Constructors on anonymous interfaces are not yet supported. + /*external factory RangeStatic();*/ external num get index; external set index(num v); external num get length; external set length(num v); } +/*type sourceType = "api" | "user" | "silent";*/ +@anonymous +@JS() +abstract class formatsType { + /* Index signature is not yet supported by JavaScript interop. */ +} + @JS("Quill") abstract class QuillStatic { - external factory QuillStatic(String selector, [QuillOptionsStatic options]); + external factory QuillStatic(dynamic /*String|Element*/ container, + [QuillOptionsStatic options]); external void deleteText(num start, num end, [String /*'api'|'user'|'silent'*/ source]); external void disable(); @@ -93,9 +100,9 @@ abstract class QuillStatic { [String /*'api'|'user'|'silent'*/ source]); /*external void insertText(num index, String text, ['api'|'user'|'silent' source]);*/ /*external void insertText(num index, String text, String format, String value, ['api'|'user'|'silent' source]);*/ - /*external void insertText(num index, String text, JSMap of formats, ['api'|'user'|'silent' source]);*/ + /*external void insertText(num index, String text, formatsType formats, ['api'|'user'|'silent' source]);*/ external void insertText(num index, String text, - [dynamic /*'api'|'user'|'silent'|String|JSMap of */ source_format_formats, + [String /*'api'|'user'|'silent'|String*/ source_format_formats, String /*String|'api'|'user'|'silent'*/ value_source, String /*'api'|'user'|'silent'*/ source]); /*external String pasteHTML(num index, String html, ['api'|'user'|'silent' source]);*/ @@ -113,23 +120,22 @@ abstract class QuillStatic { [String /*'api'|'user'|'silent'*/ source]); /*external void formatLine(num index, num length, ['api'|'user'|'silent' source]);*/ /*external void formatLine(num index, num length, String format, dynamic value, ['api'|'user'|'silent' source]);*/ - /*external void formatLine(num index, num length, JSMap of formats, ['api'|'user'|'silent' source]);*/ + /*external void formatLine(num index, num length, formatsType formats, ['api'|'user'|'silent' source]);*/ external void formatLine(num index, num length, - [dynamic /*'api'|'user'|'silent'|String|JSMap of */ source_format_formats, + [String /*'api'|'user'|'silent'|String*/ source_format_formats, dynamic /*dynamic|'api'|'user'|'silent'*/ value_source, String /*'api'|'user'|'silent'*/ source]); /*external void formatText(num index, num length, ['api'|'user'|'silent' source]);*/ /*external void formatText(num index, num length, String format, dynamic value, ['api'|'user'|'silent' source]);*/ - /*external void formatText(num index, num length, JSMap of formats, ['api'|'user'|'silent' source]);*/ + /*external void formatText(num index, num length, formatsType formats, ['api'|'user'|'silent' source]);*/ external void formatText(num index, num length, - [dynamic /*'api'|'user'|'silent'|String|JSMap of */ source_format_formats, + [String /*'api'|'user'|'silent'|String*/ source_format_formats, dynamic /*dynamic|'api'|'user'|'silent'*/ value_source, String /*'api'|'user'|'silent'*/ source]); - /*external JSMap of getFormat([RangeStatic range]);*/ - /*external JSMap of getFormat(num index, [num length]);*/ - external dynamic /*JSMap of */ getFormat( - [dynamic /*RangeStatic|num*/ range_index, num length]); - external void removeFormat(num index, num length, + /*external formatsType getFormat([RangeStatic range]);*/ + /*external formatsType getFormat(num index, [num length]);*/ + external getFormat([dynamic /*RangeStatic|num*/ range_index, num length]); + external void removeFormat(Number index, Number length, [String /*'api'|'user'|'silent'*/ source]); external void blur(); external void focus(); @@ -150,19 +156,20 @@ abstract class QuillStatic { external void debug(String level); external dynamic JS$import(String path); /*external void register(String path, dynamic def, [bool suppressWarning]);*/ - /*external void register(JSMap of defs, [bool suppressWarning]);*/ - external void register(dynamic /*String|JSMap of */ path_defs, + /*external void register(formatsType defs, [bool suppressWarning]);*/ + external void register(String path_defs, [dynamic /*dynamic|bool*/ def_suppressWarning, bool suppressWarning]); external dynamic addContainer(String className, [dynamic refNode]); external dynamic getModule(String name); } // End module QuillJS -@JS("Quill") +@JS() external QuillStatic get Quill; -@JS("Quill") +@JS() external set Quill(QuillStatic v); -// Module Quill +// Module quill /* WARNING: export assignment not yet supported. */ -// End module Quill \ No newline at end of file +// End module quill + From 2590b07dafbc552457f44f9dee231900c87770c9 Mon Sep 17 00:00:00 2001 From: Nicholas Shahan Date: Tue, 18 Oct 2016 17:04:23 -0700 Subject: [PATCH 13/22] Move application logic into lib folder Promotes the preferred directory structure and style. --- .../{1-base => captains_log_1_base}/.analysis_options | 0 dev-workflow/{1-base => captains_log_1_base}/.gitignore | 0 .../main.dart => captains_log_1_base/lib/captains_log.dart} | 3 ++- dev-workflow/{1-base => captains_log_1_base}/pubspec.yaml | 2 +- dev-workflow/{1-base => captains_log_1_base}/web/index.html | 0 dev-workflow/captains_log_1_base/web/main.dart | 5 +++++ dev-workflow/{1-base => captains_log_1_base}/web/styles.css | 0 .../{2-final => captains_log_2_final}/.analysis_options | 0 dev-workflow/{2-final => captains_log_2_final}/.gitignore | 0 .../main.dart => captains_log_2_final/lib/captains_log.dart} | 4 ++-- .../{2-final/web => captains_log_2_final/lib}/quill.dart | 0 dev-workflow/{2-final => captains_log_2_final}/pubspec.yaml | 3 +-- .../{2-final => captains_log_2_final}/web/index.html | 0 dev-workflow/captains_log_2_final/web/main.dart | 5 +++++ .../{2-final => captains_log_2_final}/web/styles.css | 0 15 files changed, 16 insertions(+), 6 deletions(-) rename dev-workflow/{1-base => captains_log_1_base}/.analysis_options (100%) rename dev-workflow/{1-base => captains_log_1_base}/.gitignore (100%) rename dev-workflow/{1-base/web/main.dart => captains_log_1_base/lib/captains_log.dart} (99%) rename dev-workflow/{1-base => captains_log_1_base}/pubspec.yaml (92%) rename dev-workflow/{1-base => captains_log_1_base}/web/index.html (100%) create mode 100644 dev-workflow/captains_log_1_base/web/main.dart rename dev-workflow/{1-base => captains_log_1_base}/web/styles.css (100%) rename dev-workflow/{2-final => captains_log_2_final}/.analysis_options (100%) rename dev-workflow/{2-final => captains_log_2_final}/.gitignore (100%) rename dev-workflow/{2-final/web/main.dart => captains_log_2_final/lib/captains_log.dart} (98%) rename dev-workflow/{2-final/web => captains_log_2_final/lib}/quill.dart (100%) rename dev-workflow/{2-final => captains_log_2_final}/pubspec.yaml (89%) rename dev-workflow/{2-final => captains_log_2_final}/web/index.html (100%) create mode 100644 dev-workflow/captains_log_2_final/web/main.dart rename dev-workflow/{2-final => captains_log_2_final}/web/styles.css (100%) diff --git a/dev-workflow/1-base/.analysis_options b/dev-workflow/captains_log_1_base/.analysis_options similarity index 100% rename from dev-workflow/1-base/.analysis_options rename to dev-workflow/captains_log_1_base/.analysis_options diff --git a/dev-workflow/1-base/.gitignore b/dev-workflow/captains_log_1_base/.gitignore similarity index 100% rename from dev-workflow/1-base/.gitignore rename to dev-workflow/captains_log_1_base/.gitignore diff --git a/dev-workflow/1-base/web/main.dart b/dev-workflow/captains_log_1_base/lib/captains_log.dart similarity index 99% rename from dev-workflow/1-base/web/main.dart rename to dev-workflow/captains_log_1_base/lib/captains_log.dart index 750119b..9ce8cac 100644 --- a/dev-workflow/1-base/web/main.dart +++ b/dev-workflow/captains_log_1_base/lib/captains_log.dart @@ -1,4 +1,5 @@ import 'dart:html'; +// TODO: Add import // ignoring leap years const int _secondsInAYear = 31536000; @@ -18,7 +19,7 @@ final List _templates = [ Map logEntries; HtmlElement logElement; -main() { +init() { // initialization // TODO: Add Quill editor diff --git a/dev-workflow/1-base/pubspec.yaml b/dev-workflow/captains_log_1_base/pubspec.yaml similarity index 92% rename from dev-workflow/1-base/pubspec.yaml rename to dev-workflow/captains_log_1_base/pubspec.yaml index 2ff75a3..787ca5a 100644 --- a/dev-workflow/1-base/pubspec.yaml +++ b/dev-workflow/captains_log_1_base/pubspec.yaml @@ -1,4 +1,4 @@ -name: captains_log +name: captains_log_1_base version: 0.0.1 description: > A starship captain's log with a WYSIWYG editor. Uses an existing JavaScript diff --git a/dev-workflow/1-base/web/index.html b/dev-workflow/captains_log_1_base/web/index.html similarity index 100% rename from dev-workflow/1-base/web/index.html rename to dev-workflow/captains_log_1_base/web/index.html diff --git a/dev-workflow/captains_log_1_base/web/main.dart b/dev-workflow/captains_log_1_base/web/main.dart new file mode 100644 index 0000000..f833231 --- /dev/null +++ b/dev-workflow/captains_log_1_base/web/main.dart @@ -0,0 +1,5 @@ +import 'package:captains_log_1_base/captains_log.dart'; + +main() { + init(); +} \ No newline at end of file diff --git a/dev-workflow/1-base/web/styles.css b/dev-workflow/captains_log_1_base/web/styles.css similarity index 100% rename from dev-workflow/1-base/web/styles.css rename to dev-workflow/captains_log_1_base/web/styles.css diff --git a/dev-workflow/2-final/.analysis_options b/dev-workflow/captains_log_2_final/.analysis_options similarity index 100% rename from dev-workflow/2-final/.analysis_options rename to dev-workflow/captains_log_2_final/.analysis_options diff --git a/dev-workflow/2-final/.gitignore b/dev-workflow/captains_log_2_final/.gitignore similarity index 100% rename from dev-workflow/2-final/.gitignore rename to dev-workflow/captains_log_2_final/.gitignore diff --git a/dev-workflow/2-final/web/main.dart b/dev-workflow/captains_log_2_final/lib/captains_log.dart similarity index 98% rename from dev-workflow/2-final/web/main.dart rename to dev-workflow/captains_log_2_final/lib/captains_log.dart index b24d88e..1ea1cfe 100644 --- a/dev-workflow/2-final/web/main.dart +++ b/dev-workflow/captains_log_2_final/lib/captains_log.dart @@ -1,6 +1,6 @@ import 'dart:html'; -import 'quill.dart' as quill; +import 'package:captains_log_2_final/quill.dart' as quill; // ignoring leap years const int _secondsInAYear = 31536000; @@ -21,7 +21,7 @@ quill.QuillStatic quillEditor; Map logEntries; HtmlElement logElement; -main() { +init() { // initialization quillEditor = new quill.QuillStatic('#editor', new quill.QuillOptionsStatic(theme: 'snow', placeholder: _prompt)); diff --git a/dev-workflow/2-final/web/quill.dart b/dev-workflow/captains_log_2_final/lib/quill.dart similarity index 100% rename from dev-workflow/2-final/web/quill.dart rename to dev-workflow/captains_log_2_final/lib/quill.dart diff --git a/dev-workflow/2-final/pubspec.yaml b/dev-workflow/captains_log_2_final/pubspec.yaml similarity index 89% rename from dev-workflow/2-final/pubspec.yaml rename to dev-workflow/captains_log_2_final/pubspec.yaml index 2ff75a3..d1da676 100644 --- a/dev-workflow/2-final/pubspec.yaml +++ b/dev-workflow/captains_log_2_final/pubspec.yaml @@ -1,4 +1,4 @@ -name: captains_log +name: captains_log_2_final version: 0.0.1 description: > A starship captain's log with a WYSIWYG editor. Uses an existing JavaScript @@ -11,5 +11,4 @@ dependencies: func: ^0.1.0 js: ^0.6.1 browser: ^0.10.0 - html: ^0.13.0 dart_to_js_script_rewriter: ^1.0.1 diff --git a/dev-workflow/2-final/web/index.html b/dev-workflow/captains_log_2_final/web/index.html similarity index 100% rename from dev-workflow/2-final/web/index.html rename to dev-workflow/captains_log_2_final/web/index.html diff --git a/dev-workflow/captains_log_2_final/web/main.dart b/dev-workflow/captains_log_2_final/web/main.dart new file mode 100644 index 0000000..cb65d36 --- /dev/null +++ b/dev-workflow/captains_log_2_final/web/main.dart @@ -0,0 +1,5 @@ +import 'package:captains_log_2_final/captains_log.dart'; + +main() { + init(); +} \ No newline at end of file diff --git a/dev-workflow/2-final/web/styles.css b/dev-workflow/captains_log_2_final/web/styles.css similarity index 100% rename from dev-workflow/2-final/web/styles.css rename to dev-workflow/captains_log_2_final/web/styles.css From 31eab81d73f05155cbfef3d62c01b830161baf45 Mon Sep 17 00:00:00 2001 From: Nicholas Shahan Date: Wed, 19 Oct 2016 14:29:06 -0700 Subject: [PATCH 14/22] Prep for bazelify --- .gitignore | 11 +++++++++++ dev-workflow/captains_log_2_final/lib/quill.dart | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d124904..16c2f0c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,14 @@ build .idea .packages .swp + +/**/bazel-bin +/**/bazel-captains_log_2_final +/**/bazel-genfiles +/**/bazel-out +/**/bazel-testlogs +/**/.bazelify +/**/BUILD +/**/WORKSPACE +/**/packages.bzl + diff --git a/dev-workflow/captains_log_2_final/lib/quill.dart b/dev-workflow/captains_log_2_final/lib/quill.dart index 3f41212..4e36c3d 100644 --- a/dev-workflow/captains_log_2_final/lib/quill.dart +++ b/dev-workflow/captains_log_2_final/lib/quill.dart @@ -135,7 +135,7 @@ abstract class QuillStatic { /*external formatsType getFormat([RangeStatic range]);*/ /*external formatsType getFormat(num index, [num length]);*/ external getFormat([dynamic /*RangeStatic|num*/ range_index, num length]); - external void removeFormat(Number index, Number length, + external void removeFormat(num index, num length, [String /*'api'|'user'|'silent'*/ source]); external void blur(); external void focus(); From 98df91fb9e94159aa5808379b653939664120e23 Mon Sep 17 00:00:00 2001 From: Nicholas Shahan Date: Wed, 19 Oct 2016 14:36:57 -0700 Subject: [PATCH 15/22] Update dependencies to be safe with DDC --- dev-workflow/captains_log_1_base/pubspec.yaml | 2 -- dev-workflow/captains_log_2_final/pubspec.yaml | 1 - 2 files changed, 3 deletions(-) diff --git a/dev-workflow/captains_log_1_base/pubspec.yaml b/dev-workflow/captains_log_1_base/pubspec.yaml index 787ca5a..5b34c24 100644 --- a/dev-workflow/captains_log_1_base/pubspec.yaml +++ b/dev-workflow/captains_log_1_base/pubspec.yaml @@ -11,5 +11,3 @@ dependencies: func: ^0.1.0 js: ^0.6.1 browser: ^0.10.0 - html: ^0.13.0 - dart_to_js_script_rewriter: ^1.0.1 diff --git a/dev-workflow/captains_log_2_final/pubspec.yaml b/dev-workflow/captains_log_2_final/pubspec.yaml index d1da676..ba85a69 100644 --- a/dev-workflow/captains_log_2_final/pubspec.yaml +++ b/dev-workflow/captains_log_2_final/pubspec.yaml @@ -11,4 +11,3 @@ dependencies: func: ^0.1.0 js: ^0.6.1 browser: ^0.10.0 - dart_to_js_script_rewriter: ^1.0.1 From a0cfb0b5cfadfd4c9887dccf0e86b872eadd4802 Mon Sep 17 00:00:00 2001 From: Nicholas Shahan Date: Thu, 20 Oct 2016 09:02:07 -0700 Subject: [PATCH 16/22] Update strong mode analysis options --- dev-workflow/captains_log_1_base/.analysis_options | 6 ++++-- dev-workflow/captains_log_2_final/.analysis_options | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dev-workflow/captains_log_1_base/.analysis_options b/dev-workflow/captains_log_1_base/.analysis_options index 0a8c163..c125039 100644 --- a/dev-workflow/captains_log_1_base/.analysis_options +++ b/dev-workflow/captains_log_1_base/.analysis_options @@ -3,8 +3,10 @@ # The commented part below is just for inspiration. Read the guide here: # https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer -# analyzer: -# strong-mode: true +#analyzer: +# strong-mode: +# - implicit-downcasts: false +# - implicit-dynamic: false # exclude: # - path/to/excluded/files/** # linter: diff --git a/dev-workflow/captains_log_2_final/.analysis_options b/dev-workflow/captains_log_2_final/.analysis_options index 6237a10..4b1b13c 100644 --- a/dev-workflow/captains_log_2_final/.analysis_options +++ b/dev-workflow/captains_log_2_final/.analysis_options @@ -3,10 +3,12 @@ # The commented part below is just for inspiration. Read the guide here: # https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer - analyzer: - strong-mode: true - exclude: - - web/quill.dart +analyzer: + strong-mode: + - implicit-downcasts: false + - implicit-dynamic: false + exclude: + - lib/quill.dart # linter: # rules: # # see catalogue here: http://dart-lang.github.io/linter/lints/ From 0d39325ba1d983e67147bfd47f3e5e69f2d246c6 Mon Sep 17 00:00:00 2001 From: Nicholas Shahan Date: Thu, 20 Oct 2016 09:14:19 -0700 Subject: [PATCH 17/22] Rename directories and add a working copy --- .../.analysis_options | 0 .../.gitignore | 0 .../lib/captains_log.dart | 0 .../pubspec.yaml | 0 .../web/index.html | 0 .../web/main.dart | 0 .../web/styles.css | 0 .../.analysis_options | 0 .../.gitignore | 0 .../lib/captains_log.dart | 0 .../lib/quill.dart | 0 .../pubspec.yaml | 0 .../web/index.html | 0 .../web/main.dart | 0 .../web/styles.css | 0 .../captains_log_working/.analysis_options | 16 +++ dev-workflow/captains_log_working/.gitignore | 22 ++++ .../lib/captains_log.dart | 109 ++++++++++++++++++ .../captains_log_working/pubspec.yaml | 13 +++ .../captains_log_working/web/index.html | 32 +++++ .../captains_log_working/web/main.dart | 5 + .../captains_log_working/web/styles.css | 107 +++++++++++++++++ 22 files changed, 304 insertions(+) rename dev-workflow/{captains_log_1_base => captains_log_base}/.analysis_options (100%) rename dev-workflow/{captains_log_1_base => captains_log_base}/.gitignore (100%) rename dev-workflow/{captains_log_1_base => captains_log_base}/lib/captains_log.dart (100%) rename dev-workflow/{captains_log_1_base => captains_log_base}/pubspec.yaml (100%) rename dev-workflow/{captains_log_1_base => captains_log_base}/web/index.html (100%) rename dev-workflow/{captains_log_1_base => captains_log_base}/web/main.dart (100%) rename dev-workflow/{captains_log_1_base => captains_log_base}/web/styles.css (100%) rename dev-workflow/{captains_log_2_final => captains_log_final}/.analysis_options (100%) rename dev-workflow/{captains_log_2_final => captains_log_final}/.gitignore (100%) rename dev-workflow/{captains_log_2_final => captains_log_final}/lib/captains_log.dart (100%) rename dev-workflow/{captains_log_2_final => captains_log_final}/lib/quill.dart (100%) rename dev-workflow/{captains_log_2_final => captains_log_final}/pubspec.yaml (100%) rename dev-workflow/{captains_log_2_final => captains_log_final}/web/index.html (100%) rename dev-workflow/{captains_log_2_final => captains_log_final}/web/main.dart (100%) rename dev-workflow/{captains_log_2_final => captains_log_final}/web/styles.css (100%) create mode 100644 dev-workflow/captains_log_working/.analysis_options create mode 100644 dev-workflow/captains_log_working/.gitignore create mode 100644 dev-workflow/captains_log_working/lib/captains_log.dart create mode 100644 dev-workflow/captains_log_working/pubspec.yaml create mode 100644 dev-workflow/captains_log_working/web/index.html create mode 100644 dev-workflow/captains_log_working/web/main.dart create mode 100644 dev-workflow/captains_log_working/web/styles.css diff --git a/dev-workflow/captains_log_1_base/.analysis_options b/dev-workflow/captains_log_base/.analysis_options similarity index 100% rename from dev-workflow/captains_log_1_base/.analysis_options rename to dev-workflow/captains_log_base/.analysis_options diff --git a/dev-workflow/captains_log_1_base/.gitignore b/dev-workflow/captains_log_base/.gitignore similarity index 100% rename from dev-workflow/captains_log_1_base/.gitignore rename to dev-workflow/captains_log_base/.gitignore diff --git a/dev-workflow/captains_log_1_base/lib/captains_log.dart b/dev-workflow/captains_log_base/lib/captains_log.dart similarity index 100% rename from dev-workflow/captains_log_1_base/lib/captains_log.dart rename to dev-workflow/captains_log_base/lib/captains_log.dart diff --git a/dev-workflow/captains_log_1_base/pubspec.yaml b/dev-workflow/captains_log_base/pubspec.yaml similarity index 100% rename from dev-workflow/captains_log_1_base/pubspec.yaml rename to dev-workflow/captains_log_base/pubspec.yaml diff --git a/dev-workflow/captains_log_1_base/web/index.html b/dev-workflow/captains_log_base/web/index.html similarity index 100% rename from dev-workflow/captains_log_1_base/web/index.html rename to dev-workflow/captains_log_base/web/index.html diff --git a/dev-workflow/captains_log_1_base/web/main.dart b/dev-workflow/captains_log_base/web/main.dart similarity index 100% rename from dev-workflow/captains_log_1_base/web/main.dart rename to dev-workflow/captains_log_base/web/main.dart diff --git a/dev-workflow/captains_log_1_base/web/styles.css b/dev-workflow/captains_log_base/web/styles.css similarity index 100% rename from dev-workflow/captains_log_1_base/web/styles.css rename to dev-workflow/captains_log_base/web/styles.css diff --git a/dev-workflow/captains_log_2_final/.analysis_options b/dev-workflow/captains_log_final/.analysis_options similarity index 100% rename from dev-workflow/captains_log_2_final/.analysis_options rename to dev-workflow/captains_log_final/.analysis_options diff --git a/dev-workflow/captains_log_2_final/.gitignore b/dev-workflow/captains_log_final/.gitignore similarity index 100% rename from dev-workflow/captains_log_2_final/.gitignore rename to dev-workflow/captains_log_final/.gitignore diff --git a/dev-workflow/captains_log_2_final/lib/captains_log.dart b/dev-workflow/captains_log_final/lib/captains_log.dart similarity index 100% rename from dev-workflow/captains_log_2_final/lib/captains_log.dart rename to dev-workflow/captains_log_final/lib/captains_log.dart diff --git a/dev-workflow/captains_log_2_final/lib/quill.dart b/dev-workflow/captains_log_final/lib/quill.dart similarity index 100% rename from dev-workflow/captains_log_2_final/lib/quill.dart rename to dev-workflow/captains_log_final/lib/quill.dart diff --git a/dev-workflow/captains_log_2_final/pubspec.yaml b/dev-workflow/captains_log_final/pubspec.yaml similarity index 100% rename from dev-workflow/captains_log_2_final/pubspec.yaml rename to dev-workflow/captains_log_final/pubspec.yaml diff --git a/dev-workflow/captains_log_2_final/web/index.html b/dev-workflow/captains_log_final/web/index.html similarity index 100% rename from dev-workflow/captains_log_2_final/web/index.html rename to dev-workflow/captains_log_final/web/index.html diff --git a/dev-workflow/captains_log_2_final/web/main.dart b/dev-workflow/captains_log_final/web/main.dart similarity index 100% rename from dev-workflow/captains_log_2_final/web/main.dart rename to dev-workflow/captains_log_final/web/main.dart diff --git a/dev-workflow/captains_log_2_final/web/styles.css b/dev-workflow/captains_log_final/web/styles.css similarity index 100% rename from dev-workflow/captains_log_2_final/web/styles.css rename to dev-workflow/captains_log_final/web/styles.css diff --git a/dev-workflow/captains_log_working/.analysis_options b/dev-workflow/captains_log_working/.analysis_options new file mode 100644 index 0000000..c125039 --- /dev/null +++ b/dev-workflow/captains_log_working/.analysis_options @@ -0,0 +1,16 @@ +# This file allows you to configure the Dart analyzer. +# +# The commented part below is just for inspiration. Read the guide here: +# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer + +#analyzer: +# strong-mode: +# - implicit-downcasts: false +# - implicit-dynamic: false +# exclude: +# - path/to/excluded/files/** +# linter: +# rules: +# # see catalogue here: http://dart-lang.github.io/linter/lints/ +# - hash_and_equals + diff --git a/dev-workflow/captains_log_working/.gitignore b/dev-workflow/captains_log_working/.gitignore new file mode 100644 index 0000000..04d4ee3 --- /dev/null +++ b/dev-workflow/captains_log_working/.gitignore @@ -0,0 +1,22 @@ +pubspec.lock +.buildlog +.packages +.project +.pub/ + +build/ +**/packages/ +web/gen +web/packages + +doc/api/ + +*.iml +*.ipr +*.iws +.idea/ +.DS_Store + +*.dart.js +*.info.json +*.js diff --git a/dev-workflow/captains_log_working/lib/captains_log.dart b/dev-workflow/captains_log_working/lib/captains_log.dart new file mode 100644 index 0000000..9ce8cac --- /dev/null +++ b/dev-workflow/captains_log_working/lib/captains_log.dart @@ -0,0 +1,109 @@ +import 'dart:html'; +// TODO: Add import + +// ignoring leap years +const int _secondsInAYear = 31536000; +const String _prompt = 'Something happened. Make it sound puzzling and heroic.'; +final List _templates = [ + 'We encountered what appeared to be a . It has ' + 'proven to be sentient and has taken control of our ship. Thus far, all ' + 'efforts at communication have failed...', + 'A warship from the has entered our ' + 'territory. It is currently speeding towards Earth. Thus far, all ' + 'efforts at peace have failed...', + 'The ship has been pulled into a . We are ' + 'observing the universe in the distant . Thus far, all ' + 'efforts to return to our timeline have failed...' +]; + +Map logEntries; +HtmlElement logElement; + +init() { + // initialization + // TODO: Add Quill editor + + logElement = document.getElementById('log'); + logEntries = new Map(); + loadPreviousEntries(); + + // listeners + document.getElementById('save').onClick.listen(saveLog); + document.getElementById('templateSelect') as SelectElement + ..onChange.listen(useTemplate); +} + +/// Capture entry in editor, save to local storage and display in log. +void appendToLog(double stardate, HtmlElement logEntryElement) { + logEntries[stardate] = logEntryElement; + window.localStorage[stardate.toString()] = logEntryElement.innerHtml; + displayLogEntry(stardate, logEntryElement); +} + +/// Calculate the current stardate: . +double calculateStardate() { + var now = new DateTime.now(); + var beginningOfYear = new DateTime(now.year); + int secondsThisYear = now.difference(beginningOfYear).inSeconds; + return now.year + secondsThisYear / _secondsInAYear; +} + +/// Copy html elements from the editor view and return them inside a new +/// DivElement. +HtmlElement captureEditorView() { + Element contentElement = document.getElementById('editor').firstChild; + + var logEntryElement = new DivElement()..innerHtml = contentElement.innerHtml; + + return logEntryElement; +} + +/// Update the dom with the provided log entry. +void displayLogEntry(double stardate, HtmlElement logEntryElement) { + if (logElement.children.isNotEmpty) { + logElement.insertAdjacentElement('afterBegin', new HRElement()); + } + + logElement.insertAdjacentElement('afterBegin', logEntryElement); + var stardateElement = new HeadingElement.h2() + ..text = 'Stardate: $stardate' + ..classes.add('stardate'); + logElement.insertAdjacentElement('afterBegin', stardateElement); +} + +/// Load all log entries from browser local storage. +void loadPreviousEntries() { + List keys = window.localStorage.keys.toList(); + keys.sort(); + for (String key in keys) { + var entryElement = new DivElement()..innerHtml = window.localStorage[key]; + logEntries[double.parse(key)] = entryElement; + } + updateDisplay(); +} + +/// Save the log entry that is currently in the editor. +void saveLog(Event _) { + // TODO: Need to save the text from the editor +} + +/// Update the dom to show all current log entries. +void updateDisplay() { + logElement.innerHtml = ''; + List starDates = logEntries.keys.toList(); + starDates.sort(); + for (double starDate in starDates) { + displayLogEntry(starDate, logEntries[starDate]); + } +} + +/// Updates the content of the editor using the selected template. +void useTemplate(Event _) { + SelectElement templateSelectElement = + document.getElementById('templateSelect'); + int selectedIndex = templateSelectElement.selectedIndex; + + if (selectedIndex == 0) return; + + // TODO: Need to clear the editor and insert the template +} diff --git a/dev-workflow/captains_log_working/pubspec.yaml b/dev-workflow/captains_log_working/pubspec.yaml new file mode 100644 index 0000000..5b34c24 --- /dev/null +++ b/dev-workflow/captains_log_working/pubspec.yaml @@ -0,0 +1,13 @@ +name: captains_log_1_base +version: 0.0.1 +description: > + A starship captain's log with a WYSIWYG editor. Uses an existing JavaScript + library with the new Dart JS-interop. + +environment: + sdk: '>=1.17.0 <2.0.0' + +dependencies: + func: ^0.1.0 + js: ^0.6.1 + browser: ^0.10.0 diff --git a/dev-workflow/captains_log_working/web/index.html b/dev-workflow/captains_log_working/web/index.html new file mode 100644 index 0000000..6dca7d4 --- /dev/null +++ b/dev-workflow/captains_log_working/web/index.html @@ -0,0 +1,32 @@ + + + + Captain's Log + + + + + + +
+

Captain's Log

+
+
+ +
+ +
+
+
+ + + + diff --git a/dev-workflow/captains_log_working/web/main.dart b/dev-workflow/captains_log_working/web/main.dart new file mode 100644 index 0000000..f833231 --- /dev/null +++ b/dev-workflow/captains_log_working/web/main.dart @@ -0,0 +1,5 @@ +import 'package:captains_log_1_base/captains_log.dart'; + +main() { + init(); +} \ No newline at end of file diff --git a/dev-workflow/captains_log_working/web/styles.css b/dev-workflow/captains_log_working/web/styles.css new file mode 100644 index 0000000..901432e --- /dev/null +++ b/dev-workflow/captains_log_working/web/styles.css @@ -0,0 +1,107 @@ +body { + padding: 0em; + margin: 0em; +} + +html { + background: #222; + color: white; + font-family: 'Jura', sans-serif; +} + +h1.title { + font-family: 'Orbitron', sans-serif; + font-size: 4em; + margin: 0em; + padding: 0.67em; +} + +h2.stardate { + font-family: 'Bungee Hairline', cursive; +} + +.buttons { + display: flex; + justify-content: space-between; + align-items: center; +} + +select { + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; + background-color: #222; + border: none; + color: inherit; + font-size: inherit; + padding: 5px; + padding-right: 18px; +} + +select:focus { + outline: none; +} + +select:active { + background-color: #222; +} + +div.select { + border-bottom: 1px solid gray; + display: inline-block; + height: 100%; + position: relative; +} + +div.select::after { + font-family: 'Material Icons'; + content: '\E5C5'; + position: absolute; + right: 2px; + top: 6px; + pointer-events: none; +} + +button { + background-color: #06c; + color: white; + border-color: #06c; + border-radius: 0.25em; + font-family: inherit; + font-size: 1.1em; + margin-top: .5em; + margin-left: 0.5em; + margin-bottom: 0.5em; + padding: .5em; +} + +#editor .ql-editor.ql-blank::before { + color: white; +} + +.ql-toolbar .ql-stroke { + stroke: white; +} + +.ql-toolbar .ql-fill { + fill: white; +} + +.ql-toolbar.ql-snow .ql-picker-label { + color: white; +} + +#content { + margin-left: 20%; + margin-right: 20%; + padding-left: 20px; + padding-right: 20px; + padding-bottom: 20px; + background: rgba(22, 22, 22, 0.9); + background-clip: padding-box; +} + +#editor { + height: 20em; + font-size: 1.1em; +} From b114b0650a90aafee238b4df21dd8b47b11beafa Mon Sep 17 00:00:00 2001 From: Nicholas Shahan Date: Thu, 20 Oct 2016 09:41:50 -0700 Subject: [PATCH 18/22] Fix typo in .analysis_options --- dev-workflow/captains_log_base/.analysis_options | 13 ++++++------- dev-workflow/captains_log_final/.analysis_options | 5 ++--- dev-workflow/captains_log_working/.analysis_options | 13 ++++++------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/dev-workflow/captains_log_base/.analysis_options b/dev-workflow/captains_log_base/.analysis_options index c125039..7c62894 100644 --- a/dev-workflow/captains_log_base/.analysis_options +++ b/dev-workflow/captains_log_base/.analysis_options @@ -3,14 +3,13 @@ # The commented part below is just for inspiration. Read the guide here: # https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer -#analyzer: -# strong-mode: -# - implicit-downcasts: false -# - implicit-dynamic: false -# exclude: -# - path/to/excluded/files/** +# analyzer: +# strong-mode: +# implicit-casts: false +# implicit-dynamic: false +# exclude: +# path/to/excluded/files/** # linter: # rules: # # see catalogue here: http://dart-lang.github.io/linter/lints/ # - hash_and_equals - diff --git a/dev-workflow/captains_log_final/.analysis_options b/dev-workflow/captains_log_final/.analysis_options index 4b1b13c..b84177c 100644 --- a/dev-workflow/captains_log_final/.analysis_options +++ b/dev-workflow/captains_log_final/.analysis_options @@ -5,12 +5,11 @@ analyzer: strong-mode: - - implicit-downcasts: false - - implicit-dynamic: false + implicit-casts: false + implicit-dynamic: false exclude: - lib/quill.dart # linter: # rules: # # see catalogue here: http://dart-lang.github.io/linter/lints/ # - hash_and_equals - diff --git a/dev-workflow/captains_log_working/.analysis_options b/dev-workflow/captains_log_working/.analysis_options index c125039..7c62894 100644 --- a/dev-workflow/captains_log_working/.analysis_options +++ b/dev-workflow/captains_log_working/.analysis_options @@ -3,14 +3,13 @@ # The commented part below is just for inspiration. Read the guide here: # https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer -#analyzer: -# strong-mode: -# - implicit-downcasts: false -# - implicit-dynamic: false -# exclude: -# - path/to/excluded/files/** +# analyzer: +# strong-mode: +# implicit-casts: false +# implicit-dynamic: false +# exclude: +# path/to/excluded/files/** # linter: # rules: # # see catalogue here: http://dart-lang.github.io/linter/lints/ # - hash_and_equals - From 71cb333b83d413aafd49946f014a0f93d07527cb Mon Sep 17 00:00:00 2001 From: Nicholas Shahan Date: Thu, 20 Oct 2016 11:09:20 -0700 Subject: [PATCH 19/22] Change all versions to use the same library name --- .gitignore | 2 +- dev-workflow/captains_log_base/pubspec.yaml | 2 +- dev-workflow/captains_log_base/web/main.dart | 2 +- dev-workflow/captains_log_final/lib/captains_log.dart | 2 +- dev-workflow/captains_log_final/pubspec.yaml | 2 +- dev-workflow/captains_log_final/web/main.dart | 2 +- dev-workflow/captains_log_working/pubspec.yaml | 2 +- dev-workflow/captains_log_working/web/main.dart | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 16c2f0c..c9f949a 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ build .swp /**/bazel-bin -/**/bazel-captains_log_2_final +/**/bazel-captains_log* /**/bazel-genfiles /**/bazel-out /**/bazel-testlogs diff --git a/dev-workflow/captains_log_base/pubspec.yaml b/dev-workflow/captains_log_base/pubspec.yaml index 5b34c24..cceeda4 100644 --- a/dev-workflow/captains_log_base/pubspec.yaml +++ b/dev-workflow/captains_log_base/pubspec.yaml @@ -1,4 +1,4 @@ -name: captains_log_1_base +name: captains_log version: 0.0.1 description: > A starship captain's log with a WYSIWYG editor. Uses an existing JavaScript diff --git a/dev-workflow/captains_log_base/web/main.dart b/dev-workflow/captains_log_base/web/main.dart index f833231..9a7d1b2 100644 --- a/dev-workflow/captains_log_base/web/main.dart +++ b/dev-workflow/captains_log_base/web/main.dart @@ -1,4 +1,4 @@ -import 'package:captains_log_1_base/captains_log.dart'; +import 'package:captains_log/captains_log.dart'; main() { init(); diff --git a/dev-workflow/captains_log_final/lib/captains_log.dart b/dev-workflow/captains_log_final/lib/captains_log.dart index 1ea1cfe..dc038ae 100644 --- a/dev-workflow/captains_log_final/lib/captains_log.dart +++ b/dev-workflow/captains_log_final/lib/captains_log.dart @@ -1,6 +1,6 @@ import 'dart:html'; -import 'package:captains_log_2_final/quill.dart' as quill; +import 'package:captains_log/quill.dart' as quill; // ignoring leap years const int _secondsInAYear = 31536000; diff --git a/dev-workflow/captains_log_final/pubspec.yaml b/dev-workflow/captains_log_final/pubspec.yaml index ba85a69..cceeda4 100644 --- a/dev-workflow/captains_log_final/pubspec.yaml +++ b/dev-workflow/captains_log_final/pubspec.yaml @@ -1,4 +1,4 @@ -name: captains_log_2_final +name: captains_log version: 0.0.1 description: > A starship captain's log with a WYSIWYG editor. Uses an existing JavaScript diff --git a/dev-workflow/captains_log_final/web/main.dart b/dev-workflow/captains_log_final/web/main.dart index cb65d36..9a7d1b2 100644 --- a/dev-workflow/captains_log_final/web/main.dart +++ b/dev-workflow/captains_log_final/web/main.dart @@ -1,4 +1,4 @@ -import 'package:captains_log_2_final/captains_log.dart'; +import 'package:captains_log/captains_log.dart'; main() { init(); diff --git a/dev-workflow/captains_log_working/pubspec.yaml b/dev-workflow/captains_log_working/pubspec.yaml index 5b34c24..cceeda4 100644 --- a/dev-workflow/captains_log_working/pubspec.yaml +++ b/dev-workflow/captains_log_working/pubspec.yaml @@ -1,4 +1,4 @@ -name: captains_log_1_base +name: captains_log version: 0.0.1 description: > A starship captain's log with a WYSIWYG editor. Uses an existing JavaScript diff --git a/dev-workflow/captains_log_working/web/main.dart b/dev-workflow/captains_log_working/web/main.dart index f833231..9a7d1b2 100644 --- a/dev-workflow/captains_log_working/web/main.dart +++ b/dev-workflow/captains_log_working/web/main.dart @@ -1,4 +1,4 @@ -import 'package:captains_log_1_base/captains_log.dart'; +import 'package:captains_log/captains_log.dart'; main() { init(); From 2f95f6fe98a610aab77351ec2582a2dfd5152d3a Mon Sep 17 00:00:00 2001 From: Nicholas Shahan Date: Thu, 20 Oct 2016 13:42:11 -0700 Subject: [PATCH 20/22] Exclude bazel folders from analysis --- dev-workflow/captains_log_base/.analysis_options | 11 ++++++++--- dev-workflow/captains_log_final/.analysis_options | 6 ++++++ dev-workflow/captains_log_working/.analysis_options | 11 ++++++++--- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/dev-workflow/captains_log_base/.analysis_options b/dev-workflow/captains_log_base/.analysis_options index 7c62894..71233fe 100644 --- a/dev-workflow/captains_log_base/.analysis_options +++ b/dev-workflow/captains_log_base/.analysis_options @@ -3,12 +3,17 @@ # The commented part below is just for inspiration. Read the guide here: # https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer -# analyzer: +analyzer: # strong-mode: # implicit-casts: false # implicit-dynamic: false -# exclude: -# path/to/excluded/files/** + exclude: + - .bazelify/** + - bazel-bin/** + - bazel-captains_log_final/** + - bazel-genfiles/** + - bazel-out/** + - bazel-testlogs/** # linter: # rules: # # see catalogue here: http://dart-lang.github.io/linter/lints/ diff --git a/dev-workflow/captains_log_final/.analysis_options b/dev-workflow/captains_log_final/.analysis_options index b84177c..fb95d07 100644 --- a/dev-workflow/captains_log_final/.analysis_options +++ b/dev-workflow/captains_log_final/.analysis_options @@ -9,6 +9,12 @@ analyzer: implicit-dynamic: false exclude: - lib/quill.dart + - .bazelify/** + - bazel-bin/** + - bazel-captains_log_final/** + - bazel-genfiles/** + - bazel-out/** + - bazel-testlogs/** # linter: # rules: # # see catalogue here: http://dart-lang.github.io/linter/lints/ diff --git a/dev-workflow/captains_log_working/.analysis_options b/dev-workflow/captains_log_working/.analysis_options index 7c62894..71233fe 100644 --- a/dev-workflow/captains_log_working/.analysis_options +++ b/dev-workflow/captains_log_working/.analysis_options @@ -3,12 +3,17 @@ # The commented part below is just for inspiration. Read the guide here: # https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer -# analyzer: +analyzer: # strong-mode: # implicit-casts: false # implicit-dynamic: false -# exclude: -# path/to/excluded/files/** + exclude: + - .bazelify/** + - bazel-bin/** + - bazel-captains_log_final/** + - bazel-genfiles/** + - bazel-out/** + - bazel-testlogs/** # linter: # rules: # # see catalogue here: http://dart-lang.github.io/linter/lints/ From ff72eb5c4e874b9eb91849ce60ffddb8b84f63c5 Mon Sep 17 00:00:00 2001 From: Nicholas Shahan Date: Fri, 21 Oct 2016 13:28:45 -0700 Subject: [PATCH 21/22] Update lines that show analysis errors with implicit-casts: false --- dev-workflow/captains_log_base/.analysis_options | 6 +++--- dev-workflow/captains_log_base/lib/captains_log.dart | 8 ++++---- dev-workflow/captains_log_base/web/main.dart | 2 +- dev-workflow/captains_log_final/lib/captains_log.dart | 10 +++++----- dev-workflow/captains_log_final/web/main.dart | 2 +- dev-workflow/captains_log_working/.analysis_options | 6 +++--- .../captains_log_working/lib/captains_log.dart | 8 ++++---- dev-workflow/captains_log_working/web/main.dart | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/dev-workflow/captains_log_base/.analysis_options b/dev-workflow/captains_log_base/.analysis_options index 71233fe..c290149 100644 --- a/dev-workflow/captains_log_base/.analysis_options +++ b/dev-workflow/captains_log_base/.analysis_options @@ -4,9 +4,9 @@ # https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer analyzer: -# strong-mode: -# implicit-casts: false -# implicit-dynamic: false +# strong-mode: +# implicit-casts: false +# implicit-dynamic: false exclude: - .bazelify/** - bazel-bin/** diff --git a/dev-workflow/captains_log_base/lib/captains_log.dart b/dev-workflow/captains_log_base/lib/captains_log.dart index 9ce8cac..6b1da67 100644 --- a/dev-workflow/captains_log_base/lib/captains_log.dart +++ b/dev-workflow/captains_log_base/lib/captains_log.dart @@ -17,9 +17,9 @@ final List _templates = [ ]; Map logEntries; -HtmlElement logElement; +Element logElement; -init() { +void init() { // initialization // TODO: Add Quill editor @@ -51,7 +51,7 @@ double calculateStardate() { /// Copy html elements from the editor view and return them inside a new /// DivElement. HtmlElement captureEditorView() { - Element contentElement = document.getElementById('editor').firstChild; + Element contentElement = document.getElementById('editor').children.first; var logEntryElement = new DivElement()..innerHtml = contentElement.innerHtml; @@ -100,7 +100,7 @@ void updateDisplay() { /// Updates the content of the editor using the selected template. void useTemplate(Event _) { SelectElement templateSelectElement = - document.getElementById('templateSelect'); + document.getElementById('templateSelect') as SelectElement; int selectedIndex = templateSelectElement.selectedIndex; if (selectedIndex == 0) return; diff --git a/dev-workflow/captains_log_base/web/main.dart b/dev-workflow/captains_log_base/web/main.dart index 9a7d1b2..88f5451 100644 --- a/dev-workflow/captains_log_base/web/main.dart +++ b/dev-workflow/captains_log_base/web/main.dart @@ -1,5 +1,5 @@ import 'package:captains_log/captains_log.dart'; -main() { +void main() { init(); } \ No newline at end of file diff --git a/dev-workflow/captains_log_final/lib/captains_log.dart b/dev-workflow/captains_log_final/lib/captains_log.dart index dc038ae..37cc4bd 100644 --- a/dev-workflow/captains_log_final/lib/captains_log.dart +++ b/dev-workflow/captains_log_final/lib/captains_log.dart @@ -19,9 +19,9 @@ final List _templates = [ quill.QuillStatic quillEditor; Map logEntries; -HtmlElement logElement; +Element logElement; -init() { +void init() { // initialization quillEditor = new quill.QuillStatic('#editor', new quill.QuillOptionsStatic(theme: 'snow', placeholder: _prompt)); @@ -53,7 +53,7 @@ double calculateStardate() { /// Copy html elements from the editor view and return them inside a new /// DivElement. HtmlElement captureEditorView() { - Element contentElement = document.getElementById('editor').firstChild; + Element contentElement = document.getElementById('editor').children.first; var logEntryElement = new DivElement()..innerHtml = contentElement.innerHtml; @@ -86,7 +86,7 @@ void loadPreviousEntries() { /// Save the log entry that is currently in the editor. void saveLog(Event _) { - DivElement logEntryElement = captureEditorView(); + HtmlElement logEntryElement = captureEditorView(); appendToLog(calculateStardate(), logEntryElement); // Clear the editor. @@ -106,7 +106,7 @@ void updateDisplay() { /// Updates the content of the editor using the selected template. void useTemplate(Event _) { SelectElement templateSelectElement = - document.getElementById('templateSelect'); + document.getElementById('templateSelect') as SelectElement; int selectedIndex = templateSelectElement.selectedIndex; if (selectedIndex == 0) return; diff --git a/dev-workflow/captains_log_final/web/main.dart b/dev-workflow/captains_log_final/web/main.dart index 9a7d1b2..88f5451 100644 --- a/dev-workflow/captains_log_final/web/main.dart +++ b/dev-workflow/captains_log_final/web/main.dart @@ -1,5 +1,5 @@ import 'package:captains_log/captains_log.dart'; -main() { +void main() { init(); } \ No newline at end of file diff --git a/dev-workflow/captains_log_working/.analysis_options b/dev-workflow/captains_log_working/.analysis_options index 71233fe..c290149 100644 --- a/dev-workflow/captains_log_working/.analysis_options +++ b/dev-workflow/captains_log_working/.analysis_options @@ -4,9 +4,9 @@ # https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer analyzer: -# strong-mode: -# implicit-casts: false -# implicit-dynamic: false +# strong-mode: +# implicit-casts: false +# implicit-dynamic: false exclude: - .bazelify/** - bazel-bin/** diff --git a/dev-workflow/captains_log_working/lib/captains_log.dart b/dev-workflow/captains_log_working/lib/captains_log.dart index 9ce8cac..6b1da67 100644 --- a/dev-workflow/captains_log_working/lib/captains_log.dart +++ b/dev-workflow/captains_log_working/lib/captains_log.dart @@ -17,9 +17,9 @@ final List _templates = [ ]; Map logEntries; -HtmlElement logElement; +Element logElement; -init() { +void init() { // initialization // TODO: Add Quill editor @@ -51,7 +51,7 @@ double calculateStardate() { /// Copy html elements from the editor view and return them inside a new /// DivElement. HtmlElement captureEditorView() { - Element contentElement = document.getElementById('editor').firstChild; + Element contentElement = document.getElementById('editor').children.first; var logEntryElement = new DivElement()..innerHtml = contentElement.innerHtml; @@ -100,7 +100,7 @@ void updateDisplay() { /// Updates the content of the editor using the selected template. void useTemplate(Event _) { SelectElement templateSelectElement = - document.getElementById('templateSelect'); + document.getElementById('templateSelect') as SelectElement; int selectedIndex = templateSelectElement.selectedIndex; if (selectedIndex == 0) return; diff --git a/dev-workflow/captains_log_working/web/main.dart b/dev-workflow/captains_log_working/web/main.dart index 9a7d1b2..88f5451 100644 --- a/dev-workflow/captains_log_working/web/main.dart +++ b/dev-workflow/captains_log_working/web/main.dart @@ -1,5 +1,5 @@ import 'package:captains_log/captains_log.dart'; -main() { +void main() { init(); } \ No newline at end of file From aacb516a170a20d5f362bc6164f693f45a3b9114 Mon Sep 17 00:00:00 2001 From: Nicholas Shahan Date: Fri, 21 Oct 2016 16:10:21 -0700 Subject: [PATCH 22/22] Move style from html element to body --- dev-workflow/captains_log_final/web/styles.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev-workflow/captains_log_final/web/styles.css b/dev-workflow/captains_log_final/web/styles.css index 67b7674..59cda9b 100644 --- a/dev-workflow/captains_log_final/web/styles.css +++ b/dev-workflow/captains_log_final/web/styles.css @@ -1,11 +1,11 @@ body { + background: url(https://cdn.spacetelescope.org/archives/images/wallpaper2/heic0601a.jpg) no-repeat center center fixed; + background-size: cover; padding: 0em; margin: 0em; } html { - background: url(https://cdn.spacetelescope.org/archives/images/wallpaper2/heic0601a.jpg) no-repeat center center fixed; - background-size: cover; color: white; font-family: 'Jura', sans-serif; }