getHTML EDITOR
¶
getHTML API extracts the content from the INK Editor and parse it into an HTML string as a resultant value.
Syntax¶
getHTML(localImages? : Boolean) : Promise<String>
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | import INKAPI from './inkapi.js'
INKAPI.ready(async () => {
const EDITOR = INKAPI.editor;
EDITOR.getHTML().then(htmlStr => {
console.log(htmlStr);
});
//Or use async/await
const htmlStr = await EDITOR.getHTML(true); // receive images src in local source url
console.log(htmlStr);
/*
Console Output:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<meta name="generator" content="INK" />
<meta name="description" content="" />
<title>My Title</title>
</head>
<body>
<h1 style="text-align: left">My Title</h1>
<p style="text-align: left">My content here!...</p>
</body>
</html>
*/
});
|
Parameters¶
Name |
Type |
Description |
---|---|---|
localImages? |
|
getHTML API provides html string with image src in base64 format, if passed |