Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Changelog

## [3.0.0] - 2025-08-13

### Major Changes

#### Added
- **TypeScript Integration**:
- Converted some core classes (Slide, WorkingFile) to TypeScript for better type safety
- Added TypeScript configuration for future project-wide adoption
- **Enhanced Text Customization**:
- Font selection from system fonts (fixes #40)
- Text positioning controls
- Toggleable text background
- **Video Controls**:
- Mute/unmute functionality for videos
- Improved video handling with black video fallback
- **Project Management**:
- New TAR-based project format replacing ZIP (fixes 2GB size limit)
- Direct archive reading capability (fixes #32)

#### Changed
- **UI Improvements**:
- Redesigned slide creator interface
- Better slide thumbnail management
- Improved sidebar navigation
- **Architectural Updates**:
- Refactored monolithic SlideCreator into modular components following SOLID principles
- Implemented new MediaResponder class for better media handling
- **Performance**:
- Optimized video streaming and resource loading
- Reduced memory usage for large projects

#### Fixed
- **Critical Issues**:
- Resolved 2GB project size limitation
- Fixed archive access problems
- **Stability**:
- Improved error handling during project save/load
- Better resource cleanup when closing projects
- **UX**:
- Smoother transitions between slides
- More reliable file operations

### Technical Details

#### New Features
- Added font selector with system font detection
- Implemented text positioning with drag-and-drop
- Created new video toolbar with mute control
- Added project save confirmation before quit

#### Code Improvements
- TypeScript migration for core components
- Modular architecture with separate classes for:
- Canvas rendering
- Sidebar management
- Text editing
- Video controls
- Improved error handling and logging

#### Dependency Updates
- Updated Electron to latest stable version
- Replaced JSZip with TAR for archive handling
- Added new dev dependencies for TypeScript support
21 changes: 21 additions & 0 deletions extraResources/fontlist/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 oldj

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
70 changes: 70 additions & 0 deletions extraResources/fontlist/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# font-list

`font-list` is a Node.js package for listing the fonts available on your system.

Current version supports **MacOS**, **Windows**, and **Linux**.

## Install

```bash
npm install font-list
```

## Usage

```js
const fontList = require('font-list')

fontList.getFonts()
.then(fonts => {
console.log(fonts)
})
.catch(err => {
console.log(err)
})
```

or like this in TypeScript:

```ts
import { getFonts } from 'font-list'

getFonts()
.then(fonts => {
console.log(fonts)
})
.catch(err => {
console.log(err)
})
```

The return value `fonts` is an Array, looks like:

```
[ '"Adobe Arabic"',
'"Adobe Caslon Pro"',
'"Adobe Devanagari"',
'"Adobe Fan Heiti Std"',
'"Adobe Fangsong Std"',
'Arial',
...
]
```

If the font name contains spaces, the name will be wrapped in double quotes, otherwise there will be no double quotes,
for example: `'"Adobe Arabic"'`, `'Arial'`.

If you don't want font names that contains spaces to be wrapped in double quotes, pass the options object
with `disableQuoting` set to true when calling the method `getFonts`:

```js
const fontList = require('font-list')

fontList.getFonts({ disableQuoting: true })
.then(fonts => {
console.log(fonts)
})
.catch(err => {
console.log(err)
})
```
15 changes: 15 additions & 0 deletions extraResources/fontlist/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @author oldj
* @blog http://oldj.net
*/

'use strict'

require('./index').getFonts()
.then(fonts => {
//console.log(fonts)
console.log(fonts.join('\n'))
})
.catch(err => {
console.log(err)
})
21 changes: 21 additions & 0 deletions extraResources/fontlist/getSystemFonts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const { getFonts } = require("./index");

function getSystemFonts() {
return new Promise((resolve, reject) => {
getFonts({ disableQuoting: true })
.then((fonts) => {
fonts = [...new Set(fonts)];
resolve(fonts || []);
})
.catch((err) => {
resolve([]);
});
});
}

(async () => {
const fonts = await getSystemFonts();
// process 处理
process.send(fonts);
// console.log('fonts', fonts);
})();
13 changes: 13 additions & 0 deletions extraResources/fontlist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* index.d.ts
* @author: oldj
* @homepage: https://oldj.net
*/

interface IOptions {
disableQuoting: boolean;
}

type FontList = string[]

export function getFonts (options?: IOptions): Promise<FontList>;
44 changes: 44 additions & 0 deletions extraResources/fontlist/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* @author oldj
* @blog http://oldj.net
*/

"use strict";

const standardize = require("./libs/standardize");
const platform = process.platform;

let getFontsFunc;
switch (platform) {
case "darwin":
getFontsFunc = require("./libs/darwin");
break;
case "win32":
getFontsFunc = require("./libs/win32");
break;
case "linux":
getFontsFunc = require("./libs/linux");
break;
default:
throw new Error(`Error: font-list can not run on ${platform}.`);
}

const defaultOptions = {
disableQuoting: false,
};

exports.getFonts = async (options) => {
options = Object.assign({}, defaultOptions, options);

let fonts = await getFontsFunc();
/* fonts = standardize(fonts, options)

*/
fonts.sort((a, b) => {
return a.replace(/^['"]+/, "").toLocaleLowerCase() <
b.replace(/^['"]+/, "").toLocaleLowerCase()
? -1
: 1;
});
return fonts;
};
Binary file added extraResources/fontlist/libs/darwin/fontlist
Binary file not shown.
14 changes: 14 additions & 0 deletions extraResources/fontlist/libs/darwin/fontlist.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>

int main(int argc, const char * argv[]) {
@autoreleasepool {
NSFontManager *fontManager = [NSFontManager sharedFontManager];
NSArray *fontFamilyNames = [[fontManager availableFontFamilies] sortedArrayUsingSelector:@selector(compare:)];

for (NSString *familyName in fontFamilyNames) {
printf("%s\n", [familyName UTF8String]);
}
}
return 0;
}
68 changes: 68 additions & 0 deletions extraResources/fontlist/libs/darwin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* index
* @author oldj
* @blog https://oldj.net
*/

'use strict'

const path = require('path')
const execFile = require('child_process').execFile
const exec = require('child_process').exec
const util = require('util')

const pexec = util.promisify(exec)

const bin = path.join(__dirname, 'fontlist')
const font_exceptions = ['iconfont']

async function getBySystemProfiler () {
const cmd = `system_profiler SPFontsDataType | grep "Family:" | awk -F: '{print $2}' | sort | uniq`
const {stdout} = await pexec(cmd, {maxBuffer: 1024 * 1024 * 10})
return stdout.split('\n').map(f => f.trim()).filter(f => !!f)
}

async function getByExecFile () {
return new Promise(async (resolve, reject) => {
execFile(bin, {maxBuffer: 1024 * 1024 * 10}, (error, stdout, stderr) => {
if (error) {
reject(error)
return
}

let fonts = []
if (stdout) {
//fonts = fonts.concat(tryToGetFonts(stdout))
fonts = fonts.concat(stdout.split('\n'))
}
if (stderr) {
//fonts = fonts.concat(tryToGetFonts(stderr))
console.error(stderr)
}

fonts = Array.from(new Set(fonts))
.filter(i => i && !font_exceptions.includes(i))

resolve(fonts)
})
})
}

module.exports = async () => {
let fonts = []
try {
fonts = await getByExecFile()
} catch (e) {
console.error(e)
}

if (fonts.length === 0) {
try {
fonts = await getBySystemProfiler()
} catch (e) {
console.error(e)
}
}

return fonts
}
28 changes: 28 additions & 0 deletions extraResources/fontlist/libs/linux/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* index
* @author: oldj
* @homepage: https://oldj.net
*/

const exec = require('child_process').exec
const util = require('util')

const pexec = util.promisify(exec)

async function binaryExists(binary) {
const { stdout } = await pexec(`whereis ${binary}`)
return stdout.length > (binary.length + 2)
}

module.exports = async () => {
const fcListBinary = await binaryExists('fc-list')
? 'fc-list'
: 'fc-list2'

const cmd = fcListBinary + ' -f "%{family[0]}\\n"'

const { stdout } = await pexec(cmd, { maxBuffer: 1024 * 1024 * 10 })
const fonts = stdout.split('\n').filter(f => !!f)

return Array.from(new Set(fonts))
}
29 changes: 29 additions & 0 deletions extraResources/fontlist/libs/standardize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* @author oldj
* @blog http://oldj.net
*/

'use strict'

module.exports = function (fonts, options) {
fonts = fonts.map(i => {
// parse unicode names, eg: '"\\U559c\\U9e4a\\U805a\\U73cd\\U4f53"' -> '"喜鹊聚珍体"'
try {
i = i.replace(/\\u([\da-f]{4})/ig, (m, s) => String.fromCharCode(parseInt(s, 16)))
} catch (e) {
console.log(e)
}

if (options && options.disableQuoting) {
if (i.startsWith('"') && i.endsWith('"')) {
i = `${i.substr(1, i.length - 2)}`
}
} else if (i.match(/[\s()+]/) && !i.startsWith('"')) {
i = `"${i}"`
}

return i
})

return fonts
}
Loading
Loading