Skip to content

Commit

Permalink
Adding a controlled editor using the grammar parser
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Feb 22, 2017
1 parent 315ee13 commit 76a62ac
Show file tree
Hide file tree
Showing 7 changed files with 2,765 additions and 0 deletions.
21 changes: 21 additions & 0 deletions controlled-grammar-editor/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<title>Controlled Block Editor With Grammar and UI</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel='stylesheet' id='h5-font-css' href='https://fonts.googleapis.com/css?family=Merriweather:700,300,700italic,300italic' />
<link href="style.css" rel="stylesheet" type="text/css" media="all">
</head>
<body>
<section class="editor" contenteditable="true"></section>
<div class="controls"></div>

<script src="lib/rangy-core.js"></script>
<script src="lib/rangy-textrange.js"></script>
<script src="initial-content.js"></script>
<script src="parser.js"></script>
<script src="main.js"></script>
<script src="../navigation.js"></script>
</body>
</html>
14 changes: 14 additions & 0 deletions controlled-grammar-editor/initial-content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
window.initialContent =
`<!-- wp:heading -->
1.0 Is The Loneliest Number
<!-- /wp -->
Many entrepreneurs idolize Steve Jobs. He’s such a perfectionist, they say. Nothing leaves the doors of 1 Infinite Loop in Cupertino without a polish and finish that makes geeks everywhere drool. No compromise!
<!-- wp:image -->
<img alt="" src="https://cldup.com/HN3-c7ER9p.jpg">
<!-- /wp -->
<!-- wp:paragraph -->
I like Apple for the opposite reason: they’re not afraid of getting a rudimentary 1.0 out into the world.
<!-- /wp -->`;
11 changes: 11 additions & 0 deletions controlled-grammar-editor/lib/rangy-core.js

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions controlled-grammar-editor/lib/rangy-textrange.js

Large diffs are not rendered by default.

492 changes: 492 additions & 0 deletions controlled-grammar-editor/main.js

Large diffs are not rendered by default.

Loading

0 comments on commit 76a62ac

Please sign in to comment.