Skip to content

Commit 441ed21

Browse files
committed
fix Image path; update deps, new ver
1 parent 38f381f commit 441ed21

File tree

5 files changed

+156
-544
lines changed

5 files changed

+156
-544
lines changed

app/main/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ app.on('ready', async () => {
116116
if (process.env.NODE_ENV === 'development') {
117117
// Install Dev Extensions
118118
console.log('installExtensions')
119-
await installExtensions();
119+
// await installExtensions();
120120
}
121121

122122
protocol.registerFileProtocol('file', (request, callback) => {

app/renderer/components/App.tsx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { plugin as DiagramPlugin } from '@podlite/diagram'
66
import Podlite from '@podlite/to-jsx'
77
const { ipcRenderer, remote } = window.require('electron');
88
import { useEffect, useState } from 'react';
9-
import { Rules } from '@podlite/schema';
9+
import { Rules, makeInterator } from '@podlite/schema';
1010

1111
import {PODLITE_CSS} from '../utils/export-html'
1212
import './App.css';
@@ -60,18 +60,30 @@ export const onConvertSource = (text:string, filePath:string, skipLineNumbers:bo
6060
return makeComponent(src, node, 'content' in node ? interator(node.content, { ...ctx}) : [] )
6161
}
6262
return {
63-
':image': setFn(( node, ctx ) => {
64-
const {path} = getPathToOpen(node.src, filePath)
65-
const filePathToOpen = path
66-
if ( filePathToOpen.match(/mp4$/) ) {
67-
return mkComponent(({ children, key })=><div className="video shadow"> <video controls> <source src={filePathToOpen} type="video/mp4" /> </video></div>)
63+
':image': setFn(( node, ctx, interator, next ) => {
64+
// const {path} = getPathToOpen(node.src, filePath)
65+
// const filePathToOpen = path
66+
if ( node.src.match(/mp4$/) ) {
67+
return mkComponent(({ children, key })=><div className="video shadow"> <video controls> <source src={node.src} type="video/mp4" /> </video></div>)
6868
} else {
69-
return mkComponent(({ children, key })=><img key={key} src={path} alt={node.alt}/>)
69+
return mkComponent(({ children, key })=><img key={key} src={node.src} alt={node.alt}/>)
7070
}
7171
}),
7272
}}
7373
let tree = podlite.parse(text);
74-
const asAst = podlite.toAstResult(tree);
74+
const {interator: astTree, ...astResult} = podlite.toAstResult(tree);
75+
// process ast tree by converting paths to absolute
76+
const rules = {
77+
":image": (node)=>{
78+
const {path} = getPathToOpen(node.src, filePath)
79+
return {...node, src:path}
80+
},
81+
}
82+
const astProcessed = makeInterator(rules)(astTree, {})
83+
const asAst = {
84+
interator: astProcessed,
85+
...astResult
86+
}
7587
//@ts-ignore
7688
return { result : <Podlite plugins={plugins} wrapElement={skipLineNumbers ? wrapFunctionNoLines : wrapFunction} tree={asAst} />, errors:asAst.errors }
7789

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"productName": "podlite",
44
"author": "Aliaksandr Zahatski",
55
"license": "MIT",
6-
"version": "0.2.1",
6+
"version": "0.3.0",
77
"description": "pod6 editor",
88
"main": "build/main.js",
99
"repository": {
@@ -95,7 +95,7 @@
9595
"entitlements": "./build/entitlements.mas.plist",
9696
"gatekeeperAssess": false,
9797
"entitlementsInherit": "./build/entitlements.mas.inherit.plist",
98-
"provisioningProfile": "build/embedded.provisionprofile"
98+
"provisioningProfile": "build/podlite_provision.provisionprofile"
9999
},
100100
"win": {
101101
"publisherName": "Aliaksandr Zahatski",
@@ -211,19 +211,19 @@
211211
"webpack-dev-server": "^4.7.2"
212212
},
213213
"dependencies": {
214-
"@podlite/diagram": "^0.0.7",
215-
"@podlite/editor-react": "^0.0.11",
216-
"@podlite/schema": "^0.0.6",
217-
"@podlite/to-jsx": "^0.0.7",
214+
"@podlite/diagram": "^0.0.10",
215+
"@podlite/editor-react": "^0.0.14",
216+
"@podlite/schema": "^0.0.7",
217+
"@podlite/to-jsx": "^0.0.10",
218218
"@types/react-router-dom": "^5.3.2",
219219
"about-window": "1.15.2",
220220
"codemirror": "5.x",
221221
"electron-is-dev": "^1.1.0",
222222
"electron-log": "^4.2.4",
223223
"electron-updater": "^4.3.4",
224224
"electron-util": "^0.14.2",
225-
"pod6": "^0.0.41",
226-
"podlite": "^0.0.11",
225+
"pod6": "0.0.43",
226+
"podlite": "^0.0.16",
227227
"react": "^16.14.0",
228228
"react-dom": "^16.14.0",
229229
"remove": "^0.1.5"

readme.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ Download the [latest release](https://github.com/zag/podlite-desktop/releases/la
3535
* And more features to come...
3636

3737
## pod6 extensions
38+
### `=Toc` - add Table of contents
39+
Examples:
40+
`=Toc head1, head2, head3
41+
`
42+
`=for Toc :title('Table of contents')
43+
head1, head2, head3
44+
`
45+
3846
### `=Image` - use images or video in posts
3947

4048
Example:
@@ -44,6 +52,10 @@ Example:
4452

4553
`=Image some-video.mp4
4654
`
55+
`=Image some-video.mp4
56+
This is a caption!
57+
`
58+
4759
### `=Diagram` - use diagrams
4860

4961
To render beautiful graphs, sequence and Gantt diagrams and flowcharts, one can use the `=Diagram` blocks.
@@ -182,7 +194,7 @@ In order to keep the match between this documentation and the last release, plea
182194

183195
## AUTHOR
184196

185-
Copyright (c) 2020 - 2021 Alexandr Zahatski
197+
Copyright (c) 2020 - 2022 Alexandr Zahatski
186198

187199

188200
## License

0 commit comments

Comments
 (0)