@tryghost/kg-parser-plugins
Advanced tools
Comparing version 0.1.0 to 0.2.0
10
index.js
/** | ||
* Copied from: | ||
* https://github.com/TryGhost/Ghost-Admin/blob/1f3d77d7230dd47a7eb5f38b90dfa510b2a16801/lib/koenig-editor/addon/options/parser-plugins.js | ||
* Which makes use of: | ||
* https://github.com/TryGhost/Ghost-Admin/blob/1f3d77d7230dd47a7eb5f38b90dfa510b2a16801/lib/koenig-editor/addon/helpers/clean-basic-html.js | ||
* | ||
@@ -41,2 +43,4 @@ * These functions are used to proces nodes during parsing from DOM -> mobiledoc | ||
let figcaption = node.querySelector('figcaption'); | ||
let kgClass = node.className.match(/kg-width-(wide|full)/); | ||
let grafClass = node.className.match(/graf--layout(FillWidth|OutsetCenter)/); | ||
@@ -53,2 +57,8 @@ if (!img) { | ||
if (kgClass) { | ||
payload.cardWidth = kgClass[1]; | ||
} else if (grafClass) { | ||
payload.cardWidth = grafClass[1] === 'FillWidth' ? 'full' : 'wide'; | ||
} | ||
if (figcaption) { | ||
@@ -55,0 +65,0 @@ // @TODO: resolve browser vs node env here |
{ | ||
"name": "@tryghost/kg-parser-plugins", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"repository": "https://github.com/TryGhost/Ghost-SDK/tree/master/packages/kg-parser-plugins", | ||
@@ -14,2 +14,5 @@ "author": "Ghost Foundation", | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"devDependencies": { | ||
@@ -19,3 +22,4 @@ "mocha": "5.2.0", | ||
"sinon": "6.3.5" | ||
} | ||
}, | ||
"gitHead": "0b00508a0359dd6d34e9844de9a3ee271c9c9a7b" | ||
} |
@@ -1,3 +0,5 @@ | ||
# Kg Parser Plugins | ||
# Koenig Parser Plugins | ||
Plugins for parsing HTML back into Ghost Mobiledoc Cards | ||
## Install | ||
@@ -14,3 +16,5 @@ | ||
Used as part of the Koenig editor. See also: [html-to-mobiledoc](https://github.com/TryGhost/Ghost-SDK/tree/master/packages/html-to-mobiledoc) | ||
## Develop | ||
@@ -36,6 +40,4 @@ | ||
# Copyright & License | ||
Copyright (c) 2018 Ghost Foundation - Released under the [MIT license](LICENSE). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
148
42
8944
11