Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a controlled editor using the grammar parser #113

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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