[next] Embed plus (#1877)

* Implement StreamEmbed instance and rename library to coral

* Add article & articleButton.html, only show embed htmls in production

* Respect assetURL

* Add tests

* Add parseHashQuery

* Fix permalink query and integration tests

* Fix permalink URL

* Remove optionalparams from pym

* Scroll when showing permalink view

* Implement autoRender

* AutoRender immediately when render permalink

* Add test for `showPermalink` event

* Add comment
This commit is contained in:
Kiwi
2018-09-21 22:43:28 +00:00
committed by Wyatt Johnson
parent 85af8d1bbf
commit 106a5d36ed
57 changed files with 906 additions and 240 deletions
+1
View File
@@ -2,3 +2,4 @@ export { default as buildURL } from "./buildURL";
export { default as ensureEndSlash } from "./ensureEndSlash";
export { default as startsWith } from "./startsWith";
export { default as prefixStorage } from "./prefixStorage";
export { default as parseHashQuery } from "./parseHashQuery";
@@ -0,0 +1,24 @@
import parseHashQuery from "./parseHashQuery";
it("should parse hash", () => {
const testCases: Array<[string, ReturnType<typeof parseHashQuery>]> = [
[
"#commentID=comment-id",
{
commentID: "comment-id",
},
],
[
"#commentID=comment-id&assetURL=asset-url",
{
commentID: "comment-id",
assetURL: "asset-url",
},
],
["#", {}],
["", {}],
];
testCases.forEach(tc => {
expect(parseHashQuery(tc[0])).toEqual(tc[1]);
});
});
@@ -0,0 +1,5 @@
import qs from "query-string";
export default function parseQueryHash(hash: string): Record<string, string> {
return qs.parse(hash);
}