Skip to content

Commit f7ec6a4

Browse files
committed
Initial commit.
0 parents  commit f7ec6a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2282
-0
lines changed

.gitattributes

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
6+
###############################################################################
7+
# Set default behavior for command prompt diff.
8+
#
9+
# This is need for earlier builds of msysgit that does not have it on by
10+
# default for csharp files.
11+
# Note: This is only used by command line
12+
###############################################################################
13+
#*.cs diff=csharp
14+
15+
###############################################################################
16+
# Set the merge driver for project and solution files
17+
#
18+
# Merging from the command prompt will add diff markers to the files if there
19+
# are conflicts (Merging from VS is not affected by the settings below, in VS
20+
# the diff markers are never inserted). Diff markers may cause the following
21+
# file extensions to fail to load in VS. An alternative would be to treat
22+
# these files as binary and thus will always conflict and require user
23+
# intervention with every merge. To do so, just uncomment the entries below
24+
###############################################################################
25+
#*.sln merge=binary
26+
#*.csproj merge=binary
27+
#*.vbproj merge=binary
28+
#*.vcxproj merge=binary
29+
#*.vcproj merge=binary
30+
#*.dbproj merge=binary
31+
#*.fsproj merge=binary
32+
#*.lsproj merge=binary
33+
#*.wixproj merge=binary
34+
#*.modelproj merge=binary
35+
#*.sqlproj merge=binary
36+
#*.wwaproj merge=binary
37+
38+
###############################################################################
39+
# behavior for image files
40+
#
41+
# image files are treated as binary by default.
42+
###############################################################################
43+
#*.jpg binary
44+
#*.png binary
45+
#*.gif binary
46+
47+
###############################################################################
48+
# diff behavior for common document formats
49+
#
50+
# Convert binary document formats to text before diffing them. This feature
51+
# is only available from the command line. Turn it on by uncommenting the
52+
# entries below.
53+
###############################################################################
54+
#*.doc diff=astextplain
55+
#*.DOC diff=astextplain
56+
#*.docx diff=astextplain
57+
#*.DOCX diff=astextplain
58+
#*.dot diff=astextplain
59+
#*.DOT diff=astextplain
60+
#*.pdf diff=astextplain
61+
#*.PDF diff=astextplain
62+
#*.rtf diff=astextplain
63+
#*.RTF diff=astextplain

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
build/package-lock.json
2+
build/node_modules/
3+
build/umbraco/Ernest/Ernest/bin/Debug/
4+
build/umbraco/Ernest/Ernest/obj/Debug/
5+
build/umbraco/Ernest/packages/
6+
7+
build/umbraco/Ernest/.vs/

CHANGELOG.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
6+
7+
## v1.0.0-beta.2
8+
9+
### Added
10+
11+
* Added tree shaking to Webpack script to reduce `bundle.js` filesize.
12+
13+
### Changed
14+
15+
* Changed `/build/assets/components/views/Ernest/Ernest.js` into a class to handle binding of editor focus properly.
16+
* Moved the colors for highlights to `/build/assets/utils/constants.js` to avoid magic strings.
17+
* Significant updates to `README.MD` in preparation for public release.
18+
* Updates to the Umbraco package config meta.
19+
* Updated `.gitignore` to prevent inclusion of VS local machine files from entering repo.
20+
21+
### Fixed
22+
23+
* The browser gives focus to the editor when the box is clicked on even if it's not inside the actual Draft.js line.
24+
25+
### Removed
26+
27+
* Removed `/build/assets/components/views/Ernest/components/Toolbar/Toolbar.js` as its functionality was moved up into the parent `Ernest.js` component to reduce code complexity and permit focus binding.
28+
29+
## v1.0.0-beta.1
30+
31+
### Added
32+
33+
* Added (grunt-umbraco-package)[https://www.npmjs.com/package/grunt-umbraco-package] based solution to build to a package zip file using `npm run package`.
34+
* Added a property value converter.
35+
36+
### Changed
37+
38+
* Modified how value is saved in the Angular wrapper so that `$scope.model.value.raw` is a [`RawDraftContentState`](https://github.com/facebook/draft-js/blob/master/src/model/encoding/RawDraftContentState.js) object using [`convertFromRaw`](https://draftjs.org/docs/api-reference-data-conversion.html#convertfromraw), and `$scope.model.value.html` is a string with the HTML version of the editor's content.
39+
40+
## v1.0.0-alpha.5
41+
42+
### Added
43+
44+
* Added support for [SASS](https://sass-lang.com/) that compiles to CSS.
45+
* Added constants for blocktypes.
46+
* Added [Prettier](https://prettier.io/).
47+
48+
### Changed
49+
50+
* Updated [Webpack](https://webpack.js.org/) to v3.
51+
* Moved toolbar to its own component and simplified its event handlers.
52+
53+
### Fixed
54+
55+
### Removed
56+
57+
## v1.0.0-alpha.4
58+
59+
### Added
60+
61+
* Added H1, H2, H3, Numbers, Quote, and Bullets buttons that control block type functionality.
62+
63+
### Changed
64+
65+
* Updated styles for toolbar.
66+
67+
## v1.0.0-alpha.3
68+
69+
### Added
70+
71+
* Added some styling to make it more closely resemble an Umbraco editor.
72+
* Added initial version of a toolbar with bold and italic support.
73+
74+
### Changed
75+
76+
* Highlighting for suggestions now are color-coded based on suggestion type.
77+
78+
### Fixed
79+
80+
* Fixed issue where user was unable to escape focus from editor due to [Editor.forceSelection()](https://draftjs.org/docs/api-reference-editor-state.html#forceselection) keeping it locked.
81+
82+
## v1.0.0-alpha.2
83+
84+
### Added
85+
86+
* Added highlighting inside the text editor where suggestions are taking place.
87+
88+
## v1.0.0-alpha.1
89+
90+
#### Added
91+
92+
* This is the original pre-release.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Kyle Weems
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<div align="center">
2+
<a href="http://github.com/cssquirrel/ernest/">
3+
<img width="239" src="https://github.com/cssquirrel/Ernest/blob/master/resources/ernest-title.png" />
4+
</a>
5+
<br>
6+
<br>
7+
<img src="https://img.shields.io/badge/version-1.0.0.beta2-yellow.svg" />
8+
<img src="https://img.shields.io/badge/our-umbraco-orange.svg">
9+
<h1>Ernest</h1>
10+
</div>
11+
12+
Ernest is a [Hemingway](http://www.hemingwayapp.com/)-like rich text editor package for the [Umbraco](https://umbraco.com/) backoffice by [Offroadcode](https://offroadcode.com). It helps editors ensure there's focus and clarity in their writing. Words and passages that could use some attention are highlighted with explanations why.
13+
14+
<div align="center">
15+
<img width="800" src="https://github.com/cssquirrel/Ernest/blob/master/resources/ernest-screenshot.png" />
16+
</div>
17+
18+
## Installation & Use
19+
20+
You can install Ernest to your Umbraco project using either the Umbraco package installer or by downloading and installing it locally from the [package on the Our package repo](http://urlgoeshere).
21+
22+
After installing the package, create a new DataType and select "Ernest Rich Text Editor" from the property editor dropdown. Add it to a DocType of your choice.
23+
24+
Once installed, in the editor for a page with Ernest you can see a rich text editor with a number of toolbar buttons for rich text. As you type into the editor, if your text contains common writing patterns that can reduce clarity they will be highlighted, with a matching explanation that appears beneath the editor. Altering the text to change your passage to avoid the writing pitfall will remove the highlighting.
25+
26+
## Outputting Ernest In Your Razor
27+
28+
The content of the Ernest property editor can be output in your templates as HTML. If you have a property editor with the alias of `foo`, then `@Model.Content.Foo` in your razor will produce the HTML in your page on the front end. The editing suggestion highlights in the editor do not appear in the HTML outputted.
29+
30+
## Questions or Issues?
31+
32+
If you have questions, feel free to ask them [here](http://urlgoeshere).
33+
34+
## Contributing
35+
36+
Do you want to contribute to Ernest, or modify its functionality? Here's how to get started.
37+
38+
### Installing Ernest on Your Machine for Development
39+
40+
1. Download the repo.
41+
2. If you do not already have the [Node.js](https://nodejs.org/) JavaScript runtime and [npm](https://docs.npmjs.com/getting-started/what-is-npm) package manager installed on your computer, you'll need to [follow this guide](https://docs.npmjs.com/getting-started/installing-node) to install them.
42+
3. Open your [CLI](https://en.wikipedia.org/wiki/Command-line_interface) and navigate to the repo's `/build` directory.
43+
4. Type the command `npm install`, which will install the various JavaScript packages used in the project.
44+
45+
### Editing the Ernest Code
46+
47+
Unlike most other Umbraco property editors, Ernest is written in [React](https://facebook.github.io/react/), which sits on top of a thin [Angular](https://angular.io/) wrapper layer that handles the communication with the backoffice. To learn more about creating your own Umbraco packages that use React in Angular, [read this blog post](http://urlgoeshere) at Offroadcode. The text editor utilizes the [Draft.js](https://draftjs.org/) framework, and the writing suggestions are powered by [write good](https://github.com/btford/write-good).
48+
49+
The files to edit are located in `/build/assets`.
50+
51+
To watch and build any changes to the JS or SASS, type `npm run webpack` in the `/build` directory in your CLI. It is unlikely that you will need to make any changes to `/build/assets/js/controllers/AngularWrapper.js', as the Angular controller is by design a very lightweight wrapper over the React code.
52+
53+
Webpack builds to `/build/dist/`, with the built property editor files are located in the `/build/dist/App_Plugins/Ernest` directory.
54+
55+
If you wish to make changes to the property value converter packaged with Ernest, you can find the VS project for it in `/build/umbraco/Ernest`.
56+
57+
To package your files into an installable Umbraco package and rebuild the package convnerter DLL, you can type `npm run package` in the `/build` directory in your CLI.
58+
59+
## Future Features Wishlist
60+
61+
The following items are on our current wishlist for improving Ernest.
62+
63+
* Making the editor's toolbar easy to customize with configuration either in the Developer tab or a .config file.
64+
* In the same config file/Developer tab functionality, permit the developer to choose which kind of prose suggestions to receive.
65+
* Combining the highlighted suggestions beneath the editor to reduce the vertical impact of many suggestions.
66+
* Putting tooltips over highlights with the suggestion text when the mouse is over them.
67+
* Abstracting out the prose suggestion functionality so that Write Good can be swapped out or augmented with other prose suggestion scripts.

build/.babelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"plugins": ["transform-flow-strip-types"],
3+
"presets": ["es2015", "react", "stage-2"]
4+
}

build/.prettierignore

Whitespace-only changes.

build/.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
arrowParens: "always",
3+
printWidth: 100,
4+
singleQuote: true,
5+
tabWidth: 4,
6+
useTabs: true
7+
}

build/Gruntfile.js

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
module.exports = function(grunt) {
2+
3+
require('load-grunt-tasks')(grunt);
4+
5+
var path = require('path');
6+
7+
grunt.initConfig({
8+
pkg: grunt.file.readJSON('package.json'),
9+
pkgMeta: grunt.file.readJSON('config/meta.json'),
10+
dest: grunt.option('target') || 'dist',
11+
basePath: path.join('<%= dest %>', 'App_Plugins', '<%= pkgMeta.name %>'),
12+
13+
watch: {
14+
options: {
15+
spawn: false,
16+
atBegin: true
17+
},
18+
dll: {
19+
files: ['umbraco/Ernest/Ernest/**/*.cs'] ,
20+
tasks: ['msbuild:dist', 'copy:dll']
21+
},
22+
},
23+
24+
copy: {
25+
dll: {
26+
cwd: 'umbraco/Ernest/Ernest/bin/debug/',
27+
src: 'Ernest.dll',
28+
dest: '<%= dest %>/bin/',
29+
expand: true
30+
},
31+
umbraco: {
32+
cwd: '<%= dest %>',
33+
src: '**/*',
34+
dest: 'tmp/umbraco',
35+
expand: true
36+
}
37+
},
38+
39+
umbracoPackage: {
40+
dist: {
41+
src: 'tmp/umbraco',
42+
dest: 'pkg',
43+
options: {
44+
name: "<%= pkgMeta.name %>",
45+
version: '<%= pkgMeta.version %>',
46+
url: '<%= pkgMeta.url %>',
47+
license: '<%= pkgMeta.license %>',
48+
licenseUrl: '<%= pkgMeta.licenseUrl %>',
49+
author: '<%= pkgMeta.author %>',
50+
authorUrl: '<%= pkgMeta.authorUrl %>',
51+
manifest: 'config/package.xml',
52+
readmeContents: '<%= grunt.file.read("config/readme.txt") %>'
53+
}
54+
55+
}
56+
},
57+
58+
clean: {
59+
build: '<%= grunt.config("basePath").substring(0, 4) == "dist" ? "dist/**/*" : "null" %>',
60+
tmp: ['tmp']
61+
},
62+
63+
msbuild: {
64+
options: {
65+
stdout: true,
66+
verbosity: 'quiet',
67+
maxCpuCount: 4,
68+
version: 4.0,
69+
buildParameters: {
70+
WarningLevel: 2,
71+
NoWarn: 1607
72+
}
73+
},
74+
dist: {
75+
src: ['umbraco/Ernest/Ernest/Ernest.csproj'],
76+
options: {
77+
projectConfiguration: 'Debug',
78+
targets: ['Clean', 'Rebuild'],
79+
}
80+
}
81+
}
82+
});
83+
84+
grunt.registerTask('default', ['msbuild:dist', 'copy:dll']);
85+
grunt.registerTask('umbraco', ['clean:tmp', 'default', 'copy:umbraco', 'umbracoPackage', 'clean:tmp']);
86+
};

build/assets/js/app.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import AngularWrapper from './controllers/AngularWrapper';
2+
3+
angular.module('umbraco').controller('Ernest.Editor', AngularWrapper);

0 commit comments

Comments
 (0)