mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-01-25 12:23:42 +00:00
Compare commits
15 Commits
internatio
...
fail-ci-in
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fe17993dc | ||
|
|
4b56cb4298 | ||
|
|
902c7f55ba | ||
|
|
801e8e312c | ||
|
|
23a576b8bd | ||
|
|
6a52081d6b | ||
|
|
246751be1b | ||
|
|
4ebaba8e89 | ||
|
|
efaa8dd1e8 | ||
|
|
326ae61929 | ||
|
|
c185e373c5 | ||
|
|
2ffbfd84a5 | ||
|
|
faef02df7a | ||
|
|
c93d56667e | ||
|
|
3855a9f013 |
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
@@ -5,7 +5,7 @@ on:
|
||||
- master
|
||||
- tiddlywiki-com
|
||||
env:
|
||||
NODE_VERSION: "12"
|
||||
NODE_VERSION: "18"
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -14,7 +14,13 @@ jobs:
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: "${{ env.NODE_VERSION }}"
|
||||
- run: "./bin/test.sh"
|
||||
- run: "./bin/ci-test.sh"
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
retention-days: 30
|
||||
build-prerelease:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/master'
|
||||
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -5,4 +5,6 @@
|
||||
tmp/
|
||||
output/
|
||||
node_modules/
|
||||
|
||||
/test-results/
|
||||
/playwright-report/
|
||||
/playwright/.cache/
|
||||
|
||||
16
bin/ci-test.sh
Executable file
16
bin/ci-test.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# test TiddlyWiki5 for tiddlywiki.com
|
||||
|
||||
npm install playwright @playwright/test
|
||||
npx playwright install chromium firefox --with-deps
|
||||
|
||||
node ./tiddlywiki.js \
|
||||
./editions/test \
|
||||
--verbose \
|
||||
--version \
|
||||
--rendertiddler $:/core/save/all test.html text/plain \
|
||||
--test \
|
||||
|| exit 1
|
||||
|
||||
npx playwright test
|
||||
@@ -18,16 +18,20 @@ Export our filter functions
|
||||
|
||||
exports.decodebase64 = function(source,operator,options) {
|
||||
var results = [];
|
||||
var binary = operator.suffixes && operator.suffixes.indexOf("binary") !== -1;
|
||||
var urlsafe = operator.suffixes && operator.suffixes.indexOf("urlsafe") !== -1;
|
||||
source(function(tiddler,title) {
|
||||
results.push($tw.utils.base64Decode(title));
|
||||
results.push($tw.utils.base64Decode(title,binary,urlsafe));
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
exports.encodebase64 = function(source,operator,options) {
|
||||
var results = [];
|
||||
var binary = operator.suffixes && operator.suffixes.indexOf("binary") !== -1;
|
||||
var urlsafe = operator.suffixes && operator.suffixes.indexOf("urlsafe") !== -1;
|
||||
source(function(tiddler,title) {
|
||||
results.push($tw.utils.base64Encode(title));
|
||||
results.push($tw.utils.base64Encode(title,binary,urlsafe));
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
@@ -58,6 +58,7 @@ Last entry/entries in list
|
||||
exports.last = function(source,operator,options) {
|
||||
var count = $tw.utils.getInt(operator.operand,1),
|
||||
results = [];
|
||||
if(count === 0) return results;
|
||||
source(function(tiddler,title) {
|
||||
results.push(title);
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ exports.tag = function(source,operator,options) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return results;
|
||||
return $tw.browser ? results.reverse() : results;
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@@ -31,7 +31,7 @@ GitHubSaver.prototype.save = function(text,method,callback) {
|
||||
headers = {
|
||||
"Accept": "application/vnd.github.v3+json",
|
||||
"Content-Type": "application/json;charset=UTF-8",
|
||||
"Authorization": "Basic " + window.btoa(username + ":" + password),
|
||||
"Authorization": "Basic " + $tw.utils.base64Encode(username + ":" + password),
|
||||
"If-None-Match": ""
|
||||
};
|
||||
// Bail if we don't have everything we need
|
||||
|
||||
@@ -40,7 +40,7 @@ exports.startup = function() {
|
||||
variables = $tw.utils.extend({},paramObject,{currentTiddler: title, "tv-window-id": windowID});
|
||||
// Open the window
|
||||
var srcWindow,
|
||||
srcDocument;
|
||||
srcDocument;
|
||||
// In case that popup blockers deny opening a new window
|
||||
try {
|
||||
srcWindow = window.open("","external-" + windowID,"scrollbars,width=" + width + ",height=" + height + (top ? ",top=" + top : "" ) + (left ? ",left=" + left : "" )),
|
||||
@@ -52,6 +52,7 @@ exports.startup = function() {
|
||||
$tw.windows[windowID] = srcWindow;
|
||||
// Check for reopening the same window
|
||||
if(srcWindow.haveInitialisedWindow) {
|
||||
srcWindow.focus();
|
||||
return;
|
||||
}
|
||||
// Initialise the document
|
||||
|
||||
@@ -187,7 +187,7 @@ HttpClientRequest.prototype.send = function(callback) {
|
||||
for (var i=0; i<len; i++) {
|
||||
binary += String.fromCharCode(bytes[i]);
|
||||
}
|
||||
resultVariables.data = window.btoa(binary);
|
||||
resultVariables.data = $tw.utils.base64Encode(binary,true);
|
||||
}
|
||||
self.wiki.addTiddler(new $tw.Tiddler(self.wiki.getTiddler(requestTrackerTitle),{
|
||||
status: completionCode,
|
||||
|
||||
@@ -819,18 +819,41 @@ exports.hashString = function(str) {
|
||||
},0);
|
||||
};
|
||||
|
||||
/*
|
||||
Base64 utility functions that work in either browser or Node.js
|
||||
*/
|
||||
if(typeof window !== 'undefined') {
|
||||
exports.btoa = function(binstr) { return window.btoa(binstr); }
|
||||
exports.atob = function(b64) { return window.atob(b64); }
|
||||
} else {
|
||||
exports.btoa = function(binstr) {
|
||||
return Buffer.from(binstr, 'binary').toString('base64');
|
||||
}
|
||||
exports.atob = function(b64) {
|
||||
return Buffer.from(b64, 'base64').toString('binary');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Decode a base64 string
|
||||
*/
|
||||
exports.base64Decode = function(string64) {
|
||||
return base64utf8.base64.decode.call(base64utf8,string64);
|
||||
exports.base64Decode = function(string64,binary,urlsafe) {
|
||||
var encoded = urlsafe ? string64.replace(/_/g,'/').replace(/-/g,'+') : string64;
|
||||
if(binary) return exports.atob(encoded)
|
||||
else return base64utf8.base64.decode.call(base64utf8,encoded);
|
||||
};
|
||||
|
||||
/*
|
||||
Encode a string to base64
|
||||
*/
|
||||
exports.base64Encode = function(string64) {
|
||||
return base64utf8.base64.encode.call(base64utf8,string64);
|
||||
exports.base64Encode = function(string64,binary,urlsafe) {
|
||||
var encoded;
|
||||
if(binary) encoded = exports.btoa(string64);
|
||||
else encoded = base64utf8.base64.encode.call(base64utf8,string64);
|
||||
if(urlsafe) {
|
||||
encoded = encoded.replace(/\+/g,'-').replace(/\//g,'_');
|
||||
}
|
||||
return encoded;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -58,24 +58,25 @@ ImageWidget.prototype.render = function(parent,nextSibling) {
|
||||
if(this.wiki.isImageTiddler(this.imageSource)) {
|
||||
var type = tiddler.fields.type,
|
||||
text = tiddler.fields.text,
|
||||
_canonical_uri = tiddler.fields._canonical_uri;
|
||||
_canonical_uri = tiddler.fields._canonical_uri,
|
||||
typeInfo = $tw.config.contentTypeInfo[type] || {},
|
||||
deserializerType = typeInfo.deserializerType || type;
|
||||
// If the tiddler has body text then it doesn't need to be lazily loaded
|
||||
if(text) {
|
||||
// Render the appropriate element for the image type
|
||||
switch(type) {
|
||||
case "application/pdf":
|
||||
// Render the appropriate element for the image type by looking up the encoding in the content type info
|
||||
var encoding = typeInfo.encoding || "utf8";
|
||||
if (encoding === "base64") {
|
||||
// .pdf .png .jpg etc.
|
||||
src = "data:" + deserializerType + ";base64," + text;
|
||||
if (deserializerType === "application/pdf") {
|
||||
tag = "embed";
|
||||
src = "data:application/pdf;base64," + text;
|
||||
break;
|
||||
case "image/svg+xml":
|
||||
src = "data:image/svg+xml," + encodeURIComponent(text);
|
||||
break;
|
||||
default:
|
||||
src = "data:" + type + ";base64," + text;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// .svg .tid .xml etc.
|
||||
src = "data:" + deserializerType + "," + encodeURIComponent(text);
|
||||
}
|
||||
} else if(_canonical_uri) {
|
||||
switch(type) {
|
||||
switch(deserializerType) {
|
||||
case "application/pdf":
|
||||
tag = "embed";
|
||||
src = _canonical_uri;
|
||||
|
||||
@@ -18,7 +18,7 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
||||
importState=<<qualify $:/state/ImportImage>> >
|
||||
<$dropzone importTitle=<<importTitle>> autoOpenOnImport="no" contentTypesFilter={{$:/config/Editor/ImportContentTypesFilter}} class="tc-dropzone-editor" enable={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}} filesOnly="yes" actions=<<importFileActions>> >
|
||||
<div>
|
||||
<div class={{{ [function[edit-preview-state]match[yes]then[tc-tiddler-preview]] +[join[ ]] }}}>
|
||||
<div class={{{ [function[edit-preview-state]match[yes]then[tc-tiddler-preview]else[tc-tiddler-preview-hidden]] [[tc-tiddler-editor]] +[join[ ]] }}}>
|
||||
|
||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ $value={{{ [subfilter<get-field-value-tiddler-filter>get[text]] }}}/>
|
||||
</td>
|
||||
<td class="tc-edit-field-remove">
|
||||
<$button class="tc-btn-invisible" tooltip={{$:/language/EditTemplate/Field/Remove/Hint}} aria-label={{$:/language/EditTemplate/Field/Remove/Caption}}>
|
||||
<$action-deletefield $field=<<currentField>>/><$set name="currentTiddlerCSSescaped" value={{{ [<currentTiddler>escapecss[]] }}}><$action-sendmessage $message="tm-focus-selector" $param=<<current-tiddler-new-field-selector>>/></$set>
|
||||
<$action-deletefield $field=<<currentField>>/>
|
||||
{{$:/core/images/delete-button}}
|
||||
</$button>
|
||||
</td>
|
||||
|
||||
@@ -118,7 +118,7 @@ tags: $:/tags/Macro
|
||||
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item" >
|
||||
<li class=<<toc-item-class>>>
|
||||
<$link to={{{ [<currentTiddler>get[target]else<currentTiddler>] }}}>
|
||||
<$list filter="[all[current]tagging[]$sort$limit[1]]" variable="ignore" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}}</$button>">
|
||||
<$list filter="[all[current]tagging[]$sort$limit[1]] -[subfilter<__exclude__>]" variable="ignore" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}}</$button>">
|
||||
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
||||
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
||||
<$transclude tiddler=<<toc-closed-icon>> />
|
||||
@@ -145,7 +145,7 @@ tags: $:/tags/Macro
|
||||
<$qualify name="toc-state" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}}>
|
||||
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
|
||||
<li class=<<toc-item-class>>>
|
||||
<$list filter="[all[current]tagging[]$sort$limit[1]]" variable="ignore" emptyMessage="""<$button class="tc-btn-invisible">{{$:/core/images/blank}}</$button><span class="toc-item-muted"><<toc-caption>></span>""">
|
||||
<$list filter="[all[current]tagging[]$sort$limit[1]] -[subfilter<__exclude__>]" variable="ignore" emptyMessage="""<$button class="tc-btn-invisible">{{$:/core/images/blank}}</$button><span class="toc-item-muted"><<toc-caption>></span>""">
|
||||
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
||||
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
||||
<$transclude tiddler=<<toc-closed-icon>> />
|
||||
|
||||
@@ -17,18 +17,16 @@ description: Under development
|
||||
```
|
||||
<% if [<animal>match[Elephant]] %>
|
||||
It is an elephant
|
||||
<% elseif [<animal>match[Giraffe]] %>
|
||||
It is a giraffe
|
||||
<% else %>
|
||||
<% if [<animal>match[Giraffe]] %>
|
||||
It is a giraffe
|
||||
<% else %>
|
||||
It is completely unknown
|
||||
<% endif %>
|
||||
It is completely unknown
|
||||
<% endif %>
|
||||
```
|
||||
|
||||
!! Explicit Templates for the ListWidget
|
||||
|
||||
<<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7784">> support for `<$list-template>` and `<$list-empty>` as immediate children of the <<.wid "ListWidget">> widget to specify the list item template and/or the empty template. Note that the <<.attr "emptyMessage">> and <<.attr "template">> attributes take precedence if they are present. For example:
|
||||
<<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7784">> support for `<$list-template>` and `<$list-empty>` as immediate children of the <<.wid "ListWidget">> widget to specify the list item template and/or the empty template. For example:
|
||||
|
||||
```
|
||||
<$list filter=<<filter>>>
|
||||
@@ -41,6 +39,8 @@ description: Under development
|
||||
</$list>
|
||||
```
|
||||
|
||||
Note that the <<.attr "emptyMessage">> and <<.attr "template">> attributes take precedence if they are present.
|
||||
|
||||
!! jsonset operator
|
||||
|
||||
<<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7742">> [[jsonset Operator]] for setting values within JSON objects
|
||||
|
||||
25
editions/test/playwright.spec.js
Normal file
25
editions/test/playwright.spec.js
Normal file
@@ -0,0 +1,25 @@
|
||||
const { test, expect } = require('@playwright/test');
|
||||
const {resolve} = require('path');
|
||||
|
||||
const indexPath = resolve(__dirname, 'output', 'test.html');
|
||||
const crossPlatformIndexPath = indexPath.replace(/^\/+/, '');
|
||||
|
||||
|
||||
test('get started link', async ({ page }) => {
|
||||
// The tests can take a while to run
|
||||
const timeout = 1000 * 30;
|
||||
test.setTimeout(timeout);
|
||||
|
||||
// Load the generated test TW html
|
||||
await page.goto(`file:///${crossPlatformIndexPath}`);
|
||||
|
||||
// Sanity check
|
||||
await expect(page.locator('.tc-site-title'), "Expected correct page title to verify the test page was loaded").toHaveText('TiddlyWiki5');
|
||||
|
||||
// Wait for jasmine results bar to appear
|
||||
await expect(page.locator('.jasmine-overall-result'), "Expected jasmine test results bar to be present").toBeVisible({timeout});
|
||||
|
||||
// Assert the tests have passed
|
||||
await expect(page.locator('.jasmine-overall-result.jasmine-failed'), "Expected jasmine tests to not have failed").not.toBeVisible();
|
||||
await expect(page.locator('.jasmine-overall-result.jasmine-passed'), "Expected jasmine tests to have passed").toBeVisible();
|
||||
});
|
||||
@@ -365,6 +365,7 @@ Tests the filtering mechanism.
|
||||
expect(wiki.filterTiddlers("[sort[title]first[8]]").join(",")).toBe("$:/ShadowPlugin,$:/TiddlerTwo,a fourth tiddler,filter regexp test,has filter,hasList,one,Tiddler Three");
|
||||
expect(wiki.filterTiddlers("[sort[title]first[x]]").join(",")).toBe("$:/ShadowPlugin");
|
||||
expect(wiki.filterTiddlers("[sort[title]last[]]").join(",")).toBe("TiddlerOne");
|
||||
expect(wiki.filterTiddlers("[sort[title]last[0]]").join(",")).toBe("");
|
||||
expect(wiki.filterTiddlers("[sort[title]last[2]]").join(",")).toBe("Tiddler Three,TiddlerOne");
|
||||
expect(wiki.filterTiddlers("[sort[title]last[8]]").join(",")).toBe("$:/TiddlerTwo,a fourth tiddler,filter regexp test,has filter,hasList,one,Tiddler Three,TiddlerOne");
|
||||
expect(wiki.filterTiddlers("[sort[title]last[x]]").join(",")).toBe("TiddlerOne");
|
||||
|
||||
@@ -48,6 +48,29 @@ describe("Utility tests", function() {
|
||||
expect($tw.utils.base64Decode($tw.utils.base64Encode(booksEmoji))).toBe(booksEmoji, "should round-trip correctly");
|
||||
});
|
||||
|
||||
it("should handle base64 encoding emojis in URL-safe variant", function() {
|
||||
var booksEmoji = "📚";
|
||||
expect($tw.utils.base64Encode(booksEmoji, false, true)).toBe("8J-Tmg==", "if surrogate pairs are correctly treated as a single code unit then base64 should be 8J+Tmg==");
|
||||
expect($tw.utils.base64Decode("8J-Tmg==", false, true)).toBe(booksEmoji);
|
||||
expect($tw.utils.base64Decode($tw.utils.base64Encode(booksEmoji, false, true), false, true)).toBe(booksEmoji, "should round-trip correctly");
|
||||
});
|
||||
|
||||
it("should handle base64 encoding binary data", function() {
|
||||
var binaryData = "\xff\xfe\xfe\xff";
|
||||
var encoded = $tw.utils.base64Encode(binaryData,true);
|
||||
expect(encoded).toBe("//7+/w==");
|
||||
var decoded = $tw.utils.base64Decode(encoded,true);
|
||||
expect(decoded).toBe(binaryData, "Binary data did not round-trip correctly");
|
||||
});
|
||||
|
||||
it("should handle base64 encoding binary data in URL-safe variant", function() {
|
||||
var binaryData = "\xff\xfe\xfe\xff";
|
||||
var encoded = $tw.utils.base64Encode(binaryData,true,true);
|
||||
expect(encoded).toBe("__7-_w==");
|
||||
var decoded = $tw.utils.base64Decode(encoded,true,true);
|
||||
expect(decoded).toBe(binaryData, "Binary data did not round-trip correctly");
|
||||
});
|
||||
|
||||
it("should handle stringifying a string array", function() {
|
||||
var str = $tw.utils.stringifyList;
|
||||
expect(str([])).toEqual("");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
caption: decodebase64
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: the input with base 64 decoding applied
|
||||
op-suffix: optional: `binary` to produce binary output, `urlsafe` for URL-safe input
|
||||
op-parameter:
|
||||
op-parameter-name:
|
||||
op-purpose: apply base 64 decoding to a string
|
||||
@@ -11,6 +12,10 @@ from-version: 5.2.6
|
||||
|
||||
See Mozilla Developer Network for details of [[base 64 encoding|https://developer.mozilla.org/en-US/docs/Glossary/Base64]]. TiddlyWiki uses [[library code from @nijikokun|https://gist.github.com/Nijikokun/5192472]] to handle the conversion.
|
||||
|
||||
The input strings must be base64 encoded. The output strings are binary data.
|
||||
The input strings must be base64 encoded. The output strings are the text (or binary data) decoded from base64 format.
|
||||
|
||||
The optional `binary` suffix, if present, changes how the input is processed. The input is normally assumed to be [[UTF-8|https://developer.mozilla.org/en-US/docs/Glossary/UTF-8]] text encoded in base64 form (such as what the <<.op "encodebase64">> operator produces), so only certain byte sequences in the input are valid. If the input is binary data encoded in base64 format (such as an image, audio file, video file, etc.), then use the optional `binary` suffix, which will allow all byte sequences. Note that the output will then be binary, ''not'' text, and should probably not be passed into further filter operators.
|
||||
|
||||
The optional `urlsafe` suffix, if present, causes the decoder to assume that the base64 input uses `-` and `_` instead of `+` and `/` for the 62nd and 63rd characters of the base64 "alphabet", which is usually referred to as "URL-safe base64" or "bae64url".
|
||||
|
||||
<<.operator-examples "decodebase64">>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
caption: encodebase64
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: the input with base 64 encoding applied
|
||||
op-suffix: optional: `binary` to treat input as binary data, `urlsafe` for URL-safe output
|
||||
op-parameter:
|
||||
op-parameter-name:
|
||||
op-purpose: apply base 64 encoding to a string
|
||||
@@ -11,6 +12,10 @@ from-version: 5.2.6
|
||||
|
||||
See Mozilla Developer Network for details of [[base 64 encoding|https://developer.mozilla.org/en-US/docs/Glossary/Base64]]. TiddlyWiki uses [[library code from @nijikokun|https://gist.github.com/Nijikokun/5192472]] to handle the conversion.
|
||||
|
||||
The input strings are interpreted as binary data. The output strings are base64 encoded.
|
||||
The input strings are interpreted as [[UTF-8 encoded|https://developer.mozilla.org/en-US/docs/Glossary/UTF-8]] text (or binary data instead if the `binary` suffix is present). The output strings are base64 encoded.
|
||||
|
||||
The optional `binary` suffix, if present, causes the input string to be interpreted as binary data instead of text. Normally, an extra UTF-8 encoding step will be added before the base64 output is produced, so that emojis and other Unicode characters will be encoded correctly. If the input is binary data, such as an image, audio file, video, etc., then the UTF-8 encoding step would produce incorrect results, so using the `binary` suffix causes the UTF-8 encoding step to be skipped.
|
||||
|
||||
The optional `urlsafe` suffix, if present, will use the alternate "URL-safe" base64 encoding, where `-` and `_` are used instead of `+` and `/` respectively, allowing the result to be used in URL query parameters or filenames.
|
||||
|
||||
<<.operator-examples "encodebase64">>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
caption: tm-open-window
|
||||
created: 20160424181447704
|
||||
modified: 20220301162140993
|
||||
modified: 20230831201518773
|
||||
tags: Messages
|
||||
title: WidgetMessage: tm-open-window
|
||||
type: text/vnd.tiddlywiki
|
||||
@@ -20,10 +20,17 @@ The `tm-open-window` [[message|Messages]] opens a tiddler in a new //browser// w
|
||||
|
||||
The `tm-open-window` message is best generated with the ActionSendMessageWidget, which in turn is triggered by a widget such as the ButtonWidget. The message is handled by the core itself.
|
||||
|
||||
<<.tip """When used with the ActionSendMessageWidget, <<.param 'param'>> becomes <<.param '$param'>> """>>
|
||||
<<.tip """Parameters <<.param template>>, <<.param windowTitle>>, <<.param width>>, <<.param height>>, <<.param left>> and <<.param top>> require the ActionSendMessageWidget.""">>
|
||||
<<.tip """<<.from-version 5.2.2>> To close a window opened with tm-open-window use [[WidgetMessage: tm-close-window]]""">>
|
||||
<<.tip """<<.from-version 5.2.2>> To open a tiddler in more than one new window, use a unique value for <<.param windowID>>""">>
|
||||
<<.tip """When used with the ActionSendMessageWidget, <<.param 'param'>> becomes <<.param '$param'>>.<br>
|
||||
Parameters <<.param template>>, <<.param windowTitle>>, <<.param width>>, <<.param height>>, <<.param left>> and <<.param top>> require the ActionSendMessageWidget. """>>
|
||||
|
||||
<<.tip """<<.from-version 5.2.2>>
|
||||
To close a window opened with tm-open-window use [[WidgetMessage: tm-close-window]]<br>
|
||||
To open a tiddler in more than one new window, use a unique value for <<.param windowID>>
|
||||
""">>
|
||||
|
||||
<<.tip """<<.from-version 5.3.2>>
|
||||
If the new window is hidden by other windows, clicking the "open" button again will bring it to the foreground and set focus to the new window. This behaviour should be consistent for all browsers now
|
||||
""">>
|
||||
|
||||
<$macrocall $name='wikitext-example-without-html'
|
||||
src="""
|
||||
|
||||
@@ -551,3 +551,5 @@ Eric Haberstroh, @pille1842, 2023/07/23
|
||||
BuckarooBanzay, @BuckarooBanzay, 2023/09/01
|
||||
|
||||
Timur, @T1mL3arn, 2023/10/04
|
||||
|
||||
Wang Ke, @Gk0Wk, 2023/10/17
|
||||
|
||||
46
playwright.config.js
Normal file
46
playwright.config.js
Normal file
@@ -0,0 +1,46 @@
|
||||
const { defineConfig, devices } = require('@playwright/test');
|
||||
|
||||
/**
|
||||
* @see https://playwright.dev/docs/test-configuration
|
||||
*/
|
||||
module.exports = defineConfig({
|
||||
testDir: './editions/test/',
|
||||
|
||||
// Allow parallel tests
|
||||
fullyParallel: true,
|
||||
|
||||
// Prevent accidentally committed "test.only" from wrecking havoc
|
||||
forbidOnly: !!process.env.CI,
|
||||
|
||||
// Do not retry tests on failure
|
||||
retries: 0,
|
||||
|
||||
// How many parallel workers
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
|
||||
// Reporter to use. See https://playwright.dev/docs/test-reporters
|
||||
reporter: 'html',
|
||||
|
||||
// Settings shared with all the tests
|
||||
use: {
|
||||
// Take a screenshot when the test fails
|
||||
screenshot: {
|
||||
mode: 'only-on-failure',
|
||||
fullPage: true
|
||||
}
|
||||
},
|
||||
|
||||
/* Configure projects for major browsers */
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
|
||||
{
|
||||
name: 'firefox',
|
||||
use: { ...devices['Desktop Firefox'] },
|
||||
}
|
||||
],
|
||||
});
|
||||
|
||||
@@ -56,6 +56,11 @@ name: tiddlywiki
|
||||
rendering-intent: auto;
|
||||
}
|
||||
|
||||
.tc-tiddler-frame .tc-tiddler-editor .tc-edit-texteditor,
|
||||
.tc-tiddler-frame .tc-tiddler-editor .tc-tiddler-preview-preview {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.cm-s-tiddlywiki.CodeMirror, .cm-s-tiddlywiki .CodeMirror-gutters { background-color: <<colour tiddler-editor-background>>; color: <<colour foreground>>; }
|
||||
.cm-s-tiddlywiki .CodeMirror-gutters {background: <<colour tiddler-editor-background>>; border-right: 1px solid <<colour tiddler-editor-border>>;}
|
||||
.cm-s-tiddlywiki .CodeMirror-linenumber {color: <<colour foreground>>;}
|
||||
|
||||
@@ -1365,6 +1365,11 @@ html body.tc-body.tc-single-tiddler-window {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview .tc-editor-toolbar,
|
||||
.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview-hidden .tc-editor-toolbar {
|
||||
grid-area: toolbar;
|
||||
}
|
||||
|
||||
.tc-editor-toolbar button {
|
||||
vertical-align: middle;
|
||||
background-color: <<colour tiddler-controls-foreground>>;
|
||||
@@ -1576,9 +1581,30 @@ html body.tc-body.tc-single-tiddler-window {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.tc-tiddler-preview-preview {
|
||||
float: right;
|
||||
width: 49%;
|
||||
.tc-tiddler-editor {
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview {
|
||||
grid-template-areas:
|
||||
"toolbar toolbar"
|
||||
"editor preview";
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-rows: auto 1fr;
|
||||
}
|
||||
|
||||
.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview-hidden {
|
||||
grid-template-areas:
|
||||
"toolbar"
|
||||
"editor";
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-rows: auto 1fr;
|
||||
}
|
||||
|
||||
.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview .tc-tiddler-preview-preview {
|
||||
grid-area: preview;
|
||||
overflow-wrap: anywhere;
|
||||
word-break: normal;
|
||||
border: 1px solid <<colour tiddler-editor-border>>;
|
||||
margin: 4px 0 3px 3px;
|
||||
padding: 3px 3px 3px 3px;
|
||||
@@ -1593,12 +1619,15 @@ html body.tc-body.tc-single-tiddler-window {
|
||||
|
||||
""">>
|
||||
|
||||
.tc-tiddler-frame .tc-tiddler-preview .tc-edit-texteditor {
|
||||
width: 49%;
|
||||
.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview .tc-edit-texteditor,
|
||||
.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview-hidden .tc-edit-texteditor {
|
||||
grid-area: editor;
|
||||
}
|
||||
|
||||
.tc-tiddler-frame .tc-tiddler-preview canvas.tc-edit-bitmapeditor {
|
||||
max-width: 49%;
|
||||
.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview canvas.tc-edit-bitmapeditor,
|
||||
.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview-hidden canvas.tc-edit-bitmapeditor {
|
||||
grid-area: editor;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.tc-edit-fields {
|
||||
|
||||
Reference in New Issue
Block a user