Commit Graph

332 Commits

Author SHA1 Message Date
Jeremy Ruston 1754be279f Merge branch 'master' into demo-alternate-store 2023-10-15 18:11:28 +01:00
lin onetwo 773c1f83f2
API for deleting core hooks (#7751)
* feat: Delete hooks from the hashmap

* fix: not using findIndex in the core

* Update HookMechanism.tid
2023-09-24 21:54:52 +01:00
Jeremy Ruston 66cba18e0f Merge branch 'master' into demo-alternate-store 2023-08-22 17:47:57 +01:00
lin onetwo b8a235697f
Improve boot kernel error reporting to include original error message (#7645) 2023-07-31 12:19:10 +01:00
Jeremy Ruston d0da1ef9d9
Fix error "Global assignment is not allowed within modules on node" (#7648) 2023-07-31 11:50:58 +01:00
Jeremy Ruston 7eeaa20e7e Merge branch 'master' into demo-alternate-store 2023-07-22 11:06:06 +01:00
Cameron Fischer 98ff6b67fd
Fixed boot so module line numbers are correct again (#7618) 2023-07-20 16:13:36 +01:00
Jeremy Ruston 709669b714 Merge branch 'master' into demo-alternate-store 2023-07-14 12:42:14 +01:00
Jeremy Ruston a6779efb1c Use locale sort for shadows
For consistency and compatibility with non-shadow ordering
2023-07-14 12:41:04 +01:00
Jeremy Ruston f48bddb167 Merge branch 'master' into demo-alternate-store 2023-07-13 19:28:02 +01:00
Jeremy Ruston 08bad90e51 Ensure shadow tiddler listings are always sorted
Currently shadow tiddler ordering depends upon the order in which the shadows appear in the plugin JSON
2023-07-13 19:27:50 +01:00
Jeremy Ruston 64ffa52da9 Write tiddlers with string fields
Otherwise date fields will get saved as JS date objects, which are not properly defined in JSON.
2023-07-07 08:22:36 +01:00
jeremy@jermolene.com 544e079033 Proof of concept of instantiating sqlite3 without needing external dependencies
We get a reference to sqlite3 but we're not yet doing anything with it

Also note that this approach leads to duplication - there will be two copies of sqlite3.js and sqlite3.wasm in each generated HTML file. The plan is to dynamically retrieve those tiddlers from the store area rather than baking them into the raw markup area
2023-06-22 14:27:37 +01:00
jeremy@jermolene.com 3561318515 Merge branch 'master' into demo-alternate-store 2023-06-22 09:17:55 +01:00
jeremy@jermolene.com 48b22abdaa Add a warning for tiddlywiki.info or plugin.info having json errors 2023-06-02 10:41:42 +01:00
Arlen22 90f0ff8067
Polyfill is not needed, only globalCheck (#7492) 2023-05-27 18:24:25 +02:00
jeremy@jermolene.com b6bc197f76 Remove unneeded override
See https://github.com/Jermolene/TiddlyWiki5/pull/7329/files#r1126709318
2023-05-10 22:27:40 +01:00
jeremy@jermolene.com 7fdd8a5164 Merge branch 'master' into demo-alternate-store 2023-05-10 22:11:55 +01:00
Arlen22 2b95daf59b
Change evalSandboxed to use only one context for all modules (#4624)
* Run modules in one new context

* Fix polyfill running on require

* Add code to check for global assignments

* Allow globals in separate context

This lets the caller request a separate context which may be polluted.

* Jasmine needs to pollute the global

* Formatting

* Add polyfill and cleanup code

* Convert to ES5

* One bug fix

* Some formatting

* Remove console.log line!

* Cleanup

* revert css-escape-polyfill.js to hopefully remove it from the PR

* Remove JSDOC directives
2023-05-06 12:11:18 +01:00
donmor 4e96a012f6
Add missing extensions for audio/mpeg (#7378)
Add missing extensions for audio/mpeg
2023-05-06 11:55:41 +01:00
Michelle Saad 4e641f4fc0
Add 'filepath' source attribute to tiddlywiki.files (#7253)
* Add 'filepath' source attribute to tiddlywiki.files

Adds a new source attribute to facilitate importing subdirectories with
the `searchSubdirectories` attribute.

The `filepath` atttribute is like `filename` except it includes the full
pathname relative to the directory path. Consequently it only works with
`directories` sections (not `tiddlers`).

* Add `subdirectories` source attribute to tiddlywiki.files

Adds another new source attribute to facilitate importing subdirectories
with the `searchSubdirectories` attribute.

The `subdirectories` source attribute is only usable with `directories`
sections (not `tiddlers`). It resolves to an array containing all the
directories in the file's path relative to the directory path. Eg, if
the directory path is `files`, `{ source: 'subdirectories' }` for a file
in  `files/images/photos` would resolve to `['images', 'photos'].

This commit also adds an example to the "tiddlywiki.files Files"
documentation tiddler that demonstrates using the `filepath` and
`subdirectories` source attributes to import and auto-tag image files
as external-image tiddlers.
2023-05-06 11:26:40 +01:00
jeremy@jermolene.com fdec12f43b Initial commit
This is the very barebones beginnings of a demo implementation of an alternate tiddler store. It is not functional. If using the Vercel builds, open developer tools in the browser to see it failing due to the absence of basic wiki methods.

The plan is to build it up into the smallest possible plain JS wiki store implementation, sharing as much implementation as possible with the existing core implementation with as little code duplication as possible. It could then serve as the basis for future experiments with wiki stores based on SQLite (@linonetwo), or a custom append only database (@yaisog).
2023-03-04 21:08:00 +00:00
jeremy@jermolene.com 4e5c957e97 Further fix to whitespace handling in $tw.utils.stringifyList
Fixes typo in 3d0ec5b1bd

See 3d0ec5b1bd (commitcomment-97804850)
2023-01-23 19:36:13 +00:00
jeremy@jermolene.com 3d0ec5b1bd Fix handling of whitespace in $tw.utils.stringifyList
Fixes #7226
2023-01-23 17:16:51 +00:00
jeremy@jermolene.com 8f7441f296 Share plugin: Further fixes to c39ef398bf
See https://talk.tiddlywiki.org/t/revived-share-plugin/5887/14

Thanks @btheado
2023-01-17 14:34:06 +00:00
jeremy@jermolene.com 0b39e47ce8 Browsers import MP3 files as audio/mpeg, not audio/mp3
Chrome changed in v81 to match Firefox and Safari - https://stackoverflow.com/questions/61363934/chrome-81-mimetype-change-to-file-upload-of-audio-mp3

Fixes #7157
2022-12-30 09:34:38 +00:00
Mario Pietsch 9f69161709
Add ignore .github, .vscode to regexp (#7148) 2022-12-24 15:58:50 +00:00
jeremy@jermolene.com 344110e289 Rearrange ordering of MP4 extension so that it defaults to video not audio
Previously using the --load command to import an MP4 file would cause it to be recognised as autio/mp4 instead of video/mp4
2022-11-09 13:56:28 +00:00
jeremy@jermolene.com 53d229592d Optimise wiki.getTiddler() 2022-09-23 18:09:16 +01:00
jeremy@jermolene.com c5d3d4c26e Disable wiki indexers in safe mode 2022-09-23 18:07:46 +01:00
jeremy@jermolene.com bc242cf83a Fix bug introduced in #4122
Fixes #6579
2022-04-01 11:38:40 +01:00
Arlen22 adcef4f803
Fix possible bug (#4122)
Check for outstanding tasks to execute before the task in question seems to have invalid checks.
2022-03-30 19:39:21 +01:00
Jeremy Ruston 36b162a377
Fix for tag ordering issue #6382 (#6383)
* Failing test

* Fix underlying problem

* Less naive fix

Now we make sure we maintain the sort order of the titles array when adding a new tiddler

* Fix failing tests

* Refactor filter tests to repeat them with different store orderings

* Revert "Fix failing tests"

This reverts commit ee03ee57f5.

* Refine fix to retain stylesheet ordering

The order of tiddlers in the HTML file uses localeCompare(), and that determines the insertion order. So if we want to be compatible with older versions we have to use localeCompare() to order tiddlers, not a plain sort()

* Don't sort shadow tiddlers

Instead rely on the existing ordering

* Fix failing tests, take 2

I think that all of these changes are explained by the store no longer retaining insertion order, but now using localecompare ordering

* Fix tests from #6327
2022-02-21 15:34:05 +00:00
Jeremy Ruston 82c8fe7fa8
Introduce JSON parse utility function with error handling (#6401)
* Introduce JSON parse utility function with error handling

Fixes #6400

* Fix typo
2022-02-21 15:29:25 +00:00
Cameron Fischer cbb002ec4b
Added sourceURL tags to boot js (#6381) 2022-01-03 17:25:40 +00:00
Joshua Fontany e32c9e4658
Feature tiddlywiki.files "searchSubdirectories" flag (#5275)
* experimenting

* recurse flag for directories in tiddlywiki.files

* searchSubdirectories docs

* filesystem cleanup to seperate PR

* cleanup

* improved docs
2021-10-27 11:16:05 +01:00
Joshua Fontany 56dae90425
Fix $tw.utils.decodeURISafe and $tw.utils.decodeURIComponentSafe not available during boot process (#6107)
* call self.displayError

* Revert "call self.displayError"

This reverts commit 5d599aa979.

* fix 5999 URI utils bug
2021-10-20 16:25:05 +01:00
jeremy@jermolene.com f6eadbd1c9 Fix crash with reading invalid JSON files 2021-09-22 12:56:55 +01:00
Cameron Fischer dcff318a98
Fix wiki.eachShadow returns overridden sources (#6036)
It was returning the underlying shadows before, even if overridden, which
was causing some bugs.

Fixes #6033
2021-09-16 20:08:11 +01:00
Joshua Fontany 33eef0202d
Adds $tw.utils.decodeURISafe and $tw.utils.decodeURIComponentSafe (#5999)
* call self.displayError

* Revert "call self.displayError"

This reverts commit 5d599aa979.

* fixes decodeURI & decodeURIComponent
2021-08-29 13:39:32 +01:00
jeremy@jermolene.com 19fd5ca5f2 Remove erroneous `\s` from field name check
Fixes #5905
2021-07-22 16:55:17 +01:00
Jeremy Ruston d455072f13
Add support for JSON-formatted tiddler store, and make it the default (#5708)
* Add support for JSON-formatted tiddler store, and make it the default

The change to `getTiddlersAsJson()` is to allow experimentation

* Move JSON tiddlers into their own store area, and fix support for encrypted tiddlers

Also add a dummy old-style store area for backwards compatibility

The current arrangement is that JSON tiddlers will always override old-style tiddlers.

* Use the deserialiser mechanism to decode the content

* Refactor $:/core/modules/deserializers.js before we start extending it

Cleaning up the helper function names and ordering

* Drop support for the "systemArea" div

It was only used in really old v5.0.x

* Update deserializer to support JSON store format and add some tests

* Life UI restrictions on characters in fieldnames

* Add another test case

* Correct mis-merge

* Remove toLowerCase() methods applied to fieldnames

* Insert line breaks in output of getTiddlersAsJson (#5786)

Rather than have the entire store on one line, insert a line break
after each tiddler.

* Refactor #5786 for backwards compatibility

* Only read .tiddlywiki-tiddler-store blocks from script tags

Prompted by @simonbaird's comment here: https://github.com/Jermolene/TiddlyWiki5/pull/5708#discussion_r648833367

* Clean up escaping of unsafe script characters

It seems that escaping `<` is sufficient

* Add docs from @saqimtiaz

Thanks @saqimtiaz

* Docs tweaks

* Remove excess whitespace

Thanks @simonbaird

* Fix templates for lazy loading

* Remove obsolete item from release note

* Clean up whitespace

* Docs for the jsontiddler widget

* Fix whitespace

Fixes #5840

* Comments

* Fix newlines in JSON store area

* Remove obsolete docs change

Co-authored-by: Simon Baird <simon.baird@gmail.com>
2021-07-14 09:15:30 +01:00
jeremy@jermolene.com 70e60cd93f Remove whitespace from plugin text
https://github.com/Jermolene/TiddlyWiki5/pull/5708#issuecomment-870749131

Has no effect on functionality, but makes the prerelease index.html go from 6821151 to 6680944 bytes (saving 6680944-6821151=-140,207 bytes or (6680944-6821151)/6680944=2.1%
2021-06-29 22:17:16 +01:00
Joe Bordes 82ec63e711
style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
cdruan 3b35411aba
Change css-escape-polyfill to a tw uitility method (#5552)
* Replace css-escape-polyfill.js with escapecss.js utility module

* Add $tw.utils.escapeCSS() method and invoke that function within the
  escapecss operator.

* Add test cases for the "escapecss" filter operator

* Fix $tw.boot.doesTaskMatchPlatform() so it works as expected if
  a module's export.platforms contains more than one values

* Add missed files to the last commit
2021-04-02 09:25:01 +01:00
Joshua Fontany a2e7cc51b5
Fix 5483 & 3483 (#5504) 2021-03-26 08:39:32 +00:00
jeremy@jermolene.com 9f9ce6595b Make it easier to subclass the wikitext parser with a custom rule set
We can now pass arrays of rule classes to the parser constructor, overriding the rules that would normally be used by the parser.

This allows us to create custom variants of the wikitext parser with their own content type.

It could also provide a basis for a new Markdown parser based on our existing wikitext parser but with new rules.
2021-02-03 15:13:56 +00:00
jeremy@jermolene.com d25e540dd2 Add support for image/vnd.microsoft.icon content type
Fixes #5357
2021-01-03 10:04:52 +00:00
Joshua Fontany c6bb783308
Fix filesystem regression (#5176)
* $:/config/OriginalTiddlerPaths if no filters match

* fixed & docs updated

* tested with tiddlywiki.files & tw.com edition

* typos

* originalpath to options, propigate isEditableFile

* syntax cleanup
2020-12-02 09:47:51 +00:00
jeremy@jermolene.com 6a91dbfe2f Add support for working with negative dates
See discussion https://groups.google.com/g/tiddlywiki/c/aHlyaHr93Io/m/vGcDa6lxAgAJ
2020-12-01 10:39:27 +00:00