Skip to content

Commit

Permalink
fix Image path; update deps, new ver
Browse files Browse the repository at this point in the history
  • Loading branch information
zag committed Feb 6, 2022
1 parent 38f381f commit 441ed21
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 544 deletions.
2 changes: 1 addition & 1 deletion app/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ app.on('ready', async () => {
if (process.env.NODE_ENV === 'development') {
// Install Dev Extensions
console.log('installExtensions')
await installExtensions();
// await installExtensions();
}

protocol.registerFileProtocol('file', (request, callback) => {
Expand Down
28 changes: 20 additions & 8 deletions app/renderer/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { plugin as DiagramPlugin } from '@podlite/diagram'
import Podlite from '@podlite/to-jsx'
const { ipcRenderer, remote } = window.require('electron');
import { useEffect, useState } from 'react';
import { Rules } from '@podlite/schema';
import { Rules, makeInterator } from '@podlite/schema';

import {PODLITE_CSS} from '../utils/export-html'
import './App.css';
Expand Down Expand Up @@ -60,18 +60,30 @@ export const onConvertSource = (text:string, filePath:string, skipLineNumbers:bo
return makeComponent(src, node, 'content' in node ? interator(node.content, { ...ctx}) : [] )
}
return {
':image': setFn(( node, ctx ) => {
const {path} = getPathToOpen(node.src, filePath)
const filePathToOpen = path
if ( filePathToOpen.match(/mp4$/) ) {
return mkComponent(({ children, key })=><div className="video shadow"> <video controls> <source src={filePathToOpen} type="video/mp4" /> </video></div>)
':image': setFn(( node, ctx, interator, next ) => {
// const {path} = getPathToOpen(node.src, filePath)
// const filePathToOpen = path
if ( node.src.match(/mp4$/) ) {
return mkComponent(({ children, key })=><div className="video shadow"> <video controls> <source src={node.src} type="video/mp4" /> </video></div>)
} else {
return mkComponent(({ children, key })=><img key={key} src={path} alt={node.alt}/>)
return mkComponent(({ children, key })=><img key={key} src={node.src} alt={node.alt}/>)
}
}),
}}
let tree = podlite.parse(text);
const asAst = podlite.toAstResult(tree);
const {interator: astTree, ...astResult} = podlite.toAstResult(tree);
// process ast tree by converting paths to absolute
const rules = {
":image": (node)=>{
const {path} = getPathToOpen(node.src, filePath)
return {...node, src:path}
},
}
const astProcessed = makeInterator(rules)(astTree, {})
const asAst = {
interator: astProcessed,
...astResult
}
//@ts-ignore
return { result : <Podlite plugins={plugins} wrapElement={skipLineNumbers ? wrapFunctionNoLines : wrapFunction} tree={asAst} />, errors:asAst.errors }

Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"productName": "podlite",
"author": "Aliaksandr Zahatski",
"license": "MIT",
"version": "0.2.1",
"version": "0.3.0",
"description": "pod6 editor",
"main": "build/main.js",
"repository": {
Expand Down Expand Up @@ -95,7 +95,7 @@
"entitlements": "./build/entitlements.mas.plist",
"gatekeeperAssess": false,
"entitlementsInherit": "./build/entitlements.mas.inherit.plist",
"provisioningProfile": "build/embedded.provisionprofile"
"provisioningProfile": "build/podlite_provision.provisionprofile"
},
"win": {
"publisherName": "Aliaksandr Zahatski",
Expand Down Expand Up @@ -211,19 +211,19 @@
"webpack-dev-server": "^4.7.2"
},
"dependencies": {
"@podlite/diagram": "^0.0.7",
"@podlite/editor-react": "^0.0.11",
"@podlite/schema": "^0.0.6",
"@podlite/to-jsx": "^0.0.7",
"@podlite/diagram": "^0.0.10",
"@podlite/editor-react": "^0.0.14",
"@podlite/schema": "^0.0.7",
"@podlite/to-jsx": "^0.0.10",
"@types/react-router-dom": "^5.3.2",
"about-window": "1.15.2",
"codemirror": "5.x",
"electron-is-dev": "^1.1.0",
"electron-log": "^4.2.4",
"electron-updater": "^4.3.4",
"electron-util": "^0.14.2",
"pod6": "^0.0.41",
"podlite": "^0.0.11",
"pod6": "0.0.43",
"podlite": "^0.0.16",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"remove": "^0.1.5"
Expand Down
14 changes: 13 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ Download the [latest release](https://github.com/zag/podlite-desktop/releases/la
* And more features to come...

## pod6 extensions
### `=Toc` - add Table of contents
Examples:
`=Toc head1, head2, head3
`
`=for Toc :title('Table of contents')
head1, head2, head3
`

### `=Image` - use images or video in posts

Example:
Expand All @@ -44,6 +52,10 @@ Example:

`=Image some-video.mp4
`
`=Image some-video.mp4
This is a caption!
`

### `=Diagram` - use diagrams

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

## AUTHOR

Copyright (c) 2020 - 2021 Alexandr Zahatski
Copyright (c) 2020 - 2022 Alexandr Zahatski


## License
Expand Down
Loading

0 comments on commit 441ed21

Please sign in to comment.