Skip to content

Commit

Permalink
Fix/build docs 🍔
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeeJab committed May 11, 2020
1 parent 093305a commit 41a7f92
Show file tree
Hide file tree
Showing 37 changed files with 377 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .jsdoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"opts": {
"readme": "./README.md",
"recurse": true,
"destination": "./docs"
"destination": "./website/demo/docs"
},
"plugins": [
"plugins/markdown"
Expand Down
94 changes: 47 additions & 47 deletions website/demo/docs/Editor.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion website/demo/docs/Key.html
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion website/demo/docs/Markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion website/demo/docs/Position.html
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion website/demo/docs/editor_edit-state.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
12 changes: 7 additions & 5 deletions website/demo/docs/editor_editor.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h1 class="page-title">Source: editor/editor.js</h1>

<section>
<article>
<pre class="prettyprint source linenums"><code>import Tooltip from '../views/tooltip';
<pre class="prettyprint source linenums"><code>import Tooltip, { DEFAULT_TOOLTIP } from '../views/tooltip';
import PostEditor from './post';
import ImageCard from '../cards/image';
import { DIRECTION } from '../utils/key';
Expand Down Expand Up @@ -84,7 +84,8 @@ <h1 class="page-title">Source: editor/editor.js</h1>
throw new MobiledocError(`Unknown atom encountered: ${env.name}`);
},
mobiledoc: null,
html: null
html: null,
tooltip: DEFAULT_TOOLTIP
};

const CALLBACK_QUEUES = {
Expand Down Expand Up @@ -231,7 +232,7 @@ <h1 class="page-title">Source: editor/editor.js</h1>
return this._parser.parse(dom);
}
} else {
return this.builder.createPost();
return this.builder.createPost([this.builder.createMarkupSection()]);
}
}

Expand Down Expand Up @@ -300,7 +301,8 @@ <h1 class="page-title">Source: editor/editor.js</h1>
_addTooltip() {
this.addView(new Tooltip({
rootElement: this.element,
showForTag: 'a'
showForTag: 'a',
editor: this
}));
}

Expand Down Expand Up @@ -1217,7 +1219,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion website/demo/docs/editor_mutation-handler.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
16 changes: 13 additions & 3 deletions website/demo/docs/editor_post.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ <h1 class="page-title">Source: editor/post.js</h1>
return tagName === 'ul' || tagName === 'ol';
}

function shrinkRange(range) {
const { head, tail } = range;

if (tail.offset === 0 &amp;&amp; head.section !== tail.section) {
range.tail = new Position(tail.section.prev, tail.section.prev.length);
}

return range;
}

const CALLBACK_QUEUES = {
BEFORE_COMPLETE: 'beforeComplete',
COMPLETE: 'complete',
Expand All @@ -57,7 +67,6 @@ <h1 class="page-title">Source: editor/post.js</h1>
DELETE: 2
};


/**
* The PostEditor is used to modify a post. It should not be instantiated directly.
* Instead, a new instance of a PostEditor is created by the editor and passed
Expand Down Expand Up @@ -814,7 +823,7 @@ <h1 class="page-title">Source: editor/post.js</h1>
* @public
*/
toggleSection(sectionTagName, range=this._range) {
range = toRange(range);
range = shrinkRange(toRange(range));

sectionTagName = normalizeTagName(sectionTagName);
let { post } = this.editor;
Expand All @@ -830,6 +839,7 @@ <h1 class="page-title">Source: editor/post.js</h1>
let sectionTransformations = [];
post.walkMarkerableSections(range, section => {
let changedSection = this.changeSectionTagName(section, tagName);

sectionTransformations.push({
from: section,
to: changedSection
Expand Down Expand Up @@ -1300,7 +1310,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion website/demo/docs/editor_text-input-handlers.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
43 changes: 38 additions & 5 deletions website/demo/docs/editor_ui.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ <h1 class="page-title">Source: editor/ui.js</h1>
* @module UI
*/

import Position from '../utils/cursor/position';
import Range from '../utils/cursor/range';

let defaultShowPrompt = (message, defaultValue, callback) => callback(window.prompt(message, defaultValue));

/**
* @callback promptCallback
* @param {String} url The URL to pass back to the editor for linking
Expand Down Expand Up @@ -67,9 +72,6 @@ <h1 class="page-title">Source: editor/ui.js</h1>
* });
* @public
*/

let defaultShowPrompt = (message, defaultValue, callback) => callback(window.prompt(message, defaultValue));

export function toggleLink(editor, showPrompt=defaultShowPrompt) {
if (editor.range.isCollapsed) {
return;
Expand All @@ -93,8 +95,39 @@ <h1 class="page-title">Source: editor/ui.js</h1>
}
}

/**
* Exposes the core behavior for editing an existing link, and allows for
* customization of the URL input handler.
* @param {HTMLAnchorElement} target The anchor (&lt;a>) DOM element whose URL should be edited.
* @param {Editor} editor An editor instance to operate on. If a range is selected,
* either prompt for a URL and add a link or un-link the
* currently linked text.
* @param {module:UI~showPrompt} [showPrompt] An optional custom input handler. Defaults
* to using `window.prompt`.
*
* @public
*/
export function editLink(target, editor, showPrompt=defaultShowPrompt) {
showPrompt('Enter a URL', target.href, url => {
if (!url) { return; }

const position = Position.fromNode(editor._renderTree, target.firstChild);
const range = new Range(position, new Position(position.section, position.offset + target.textContent.length));

editor.run(post => {
let markup = editor.builder.createMarkup('a', {href: url});

// This is the only way to "update" a markup with new attributes in the
// current API.
post.toggleMarkup(markup, range);
post.toggleMarkup(markup, range);
});
});
}

export default {
toggleLink
toggleLink,
editLink
};
</code></pre>
</article>
Expand All @@ -112,7 +145,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
4 changes: 2 additions & 2 deletions website/demo/docs/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -3141,7 +3141,7 @@ <h6>Properties</h6>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="editor_editor.js.html">editor/editor.js</a>, <a href="editor_editor.js.html#line864">line 864</a>
<a href="editor_editor.js.html">editor/editor.js</a>, <a href="editor_editor.js.html#line866">line 866</a>
</li></ul></dd>


Expand Down Expand Up @@ -3191,7 +3191,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
13 changes: 10 additions & 3 deletions website/demo/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,16 @@ <h3>Demo</h3>
<p>To run the demo site locally:</p>
<ul>
<li><code>yarn start</code></li>
<li><code>open http://localhost:4200/demo</code></li>
<li><code>open http://localhost:4200/website/demo</code></li>
</ul>
<p>The assets for the demo are in <code>assets/demo</code>.</p>
<h3>Debugging</h3>
<p>A debugging environment that prints useful information about the active Mobiledoc editor
can be access by:</p>
<ul>
<li><code>yarn start</code></li>
<li><code>open http://localhost:4200/website/demo/debug.html</code></li>
</ul>
<h3>Getting Help</h3>
<p>If you notice a bug or have a feature request please <a href="https://github.com/bustle/mobiledoc-kit/issues">open an issue on github</a>.
If you have a question about usage you can post in the <a href="https://mobiledoc-kit.slack.com/">slack channel</a> (automatic invites available from our <a href="https://mobiledoc-slack.herokuapp.com/">slackin app</a>) or on StackOverflow using the <a href="http://stackoverflow.com/questions/tagged/mobiledoc-kit"><code>mobiledoc-kit</code> tag</a>.</p>
Expand All @@ -458,7 +465,7 @@ <h3>Deploy the demo</h3>
<p>The demo website is hosted at
<a href="https://bustle.github.io/mobiledoc-kit/demo">bustle.github.io/mobiledoc-kit/demo</a>.</p>
<p>To preview the website, start the server and visit
<a href="http://localhost:4200/demo/">http://localhost:4200/demo/</a>. The code for
<a href="http://localhost:4200/assets/demo/">http://localhost:4200/assets/demo/</a>. The code for
this website can be found in <code>assets/demo/</code>. Note that the development server
does not rebuild jsdoc.</p>
<p>To publish a new version:</p>
Expand All @@ -484,7 +491,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion website/demo/docs/models__markerable.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion website/demo/docs/models__section.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion website/demo/docs/models_list-section.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion website/demo/docs/models_marker.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion website/demo/docs/models_markup.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion website/demo/docs/models_post-node-builder.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
14 changes: 11 additions & 3 deletions website/demo/docs/models_post.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ <h1 class="page-title">Source: models/post.js</h1>
trimTo(range) {
const post = this.builder.createPost();
const { builder } = this;
const { head, tail } = range;
const tailNotSelected = tail.offset === 0 &amp;&amp; head.section !== tail.section;

let sectionParent = post,
listParent = null;
Expand All @@ -240,7 +242,10 @@ <h1 class="page-title">Source: models/post.js</h1>
} else {
listParent = null;
sectionParent = post;
newSection = builder.createMarkupSection(section.tagName);
const tagName = tailNotSelected &amp;&amp; tail.section === section ?
'p' :
section.tagName;
newSection = builder.createMarkupSection(tagName);
}

let currentRange = range.trimTo(section);
Expand All @@ -249,7 +254,10 @@ <h1 class="page-title">Source: models/post.js</h1>
m => newSection.markers.append(m)
);
} else {
newSection = section.clone();
newSection = tailNotSelected &amp;&amp; tail.section === section ?
builder.createMarkupSection('p') :
section.clone();

sectionParent = post;
}
if (sectionParent) {
Expand Down Expand Up @@ -277,7 +285,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion website/demo/docs/models_render-tree.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-UI
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Fri Feb 21 2020 16:59:47 GMT-0500 (Eastern Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon May 11 2020 17:04:26 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
Loading

0 comments on commit 41a7f92

Please sign in to comment.