feat: Initial clean release of CHM
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
这个提交包含在:
@@ -0,0 +1,32 @@
|
||||
import joplin from 'api';
|
||||
import { ContentScriptType } from 'api/types';
|
||||
|
||||
joplin.plugins.register({
|
||||
onStart: async function() {
|
||||
await joplin.commands.register({
|
||||
name: 'testCommand',
|
||||
label: 'My Test Command',
|
||||
execute: async (...args) => {
|
||||
alert('Got command "testCommand" with args: ' + JSON.stringify(args));
|
||||
},
|
||||
});
|
||||
|
||||
await joplin.commands.register({
|
||||
name: 'testCommandNoArgs',
|
||||
label: 'My Test Command (no args)',
|
||||
execute: async () => {
|
||||
alert('Got command "testCommandNoArgs"');
|
||||
},
|
||||
});
|
||||
|
||||
await joplin.contentScripts.register(
|
||||
ContentScriptType.MarkdownItPlugin,
|
||||
'justtesting',
|
||||
'./markdownItTestPlugin.js'
|
||||
);
|
||||
|
||||
await joplin.contentScripts.onMessage('justtesting', (message:any) => {
|
||||
return message + '+response';
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"id": "org.joplinapp.plugins.ContentScriptDemo",
|
||||
"manifest_version": 1,
|
||||
"app_min_version": "1.4",
|
||||
"name": "Content Script Test",
|
||||
"description": "",
|
||||
"version": "1.0.0",
|
||||
"author": "",
|
||||
"homepage_url": ""
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
.just-testing {
|
||||
background-color: rgb(202, 255, 255);
|
||||
color: rgb(82, 0, 78);
|
||||
}
|
||||
|
||||
.just-testing a {
|
||||
background-color: rgb(202, 255, 255);
|
||||
color: rgb(10, 0, 104);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
const leftPad = require('left-pad');
|
||||
|
||||
export default function(context) {
|
||||
return {
|
||||
plugin: function(markdownIt, _options) {
|
||||
const contentScriptId = context.contentScriptId;
|
||||
|
||||
const defaultRender = markdownIt.renderer.rules.fence || function(tokens, idx, options, env, self) {
|
||||
return self.renderToken(tokens, idx, options, env, self);
|
||||
};
|
||||
|
||||
markdownIt.renderer.rules.fence = function(tokens, idx, options, env, self) {
|
||||
const token = tokens[idx];
|
||||
if (token.info !== 'justtesting') return defaultRender(tokens, idx, options, env, self);
|
||||
|
||||
// Rich text editor support:
|
||||
// The joplin-editable and joplin-source CSS classes mark the generated div
|
||||
// as a region that needs special processing when converting back to markdown.
|
||||
// This element helps Joplin reconstruct the original markdown.
|
||||
const richTextEditorMetadata = `
|
||||
<pre
|
||||
class="joplin-source"
|
||||
data-joplin-language="justtesting"
|
||||
data-joplin-source-open="\`\`\`justtesting\n"
|
||||
data-joplin-source-close="\`\`\`"
|
||||
>${markdownIt.utils.escapeHtml(token.content)}</pre>
|
||||
`;
|
||||
|
||||
return `
|
||||
<div class="just-testing joplin-editable">
|
||||
${richTextEditorMetadata}
|
||||
|
||||
<p>JUST TESTING: <pre>${markdownIt.utils.escapeHtml(leftPad(token.content.trim(), 10, 'x'))}</pre></p>
|
||||
<p>
|
||||
<a
|
||||
href="#"
|
||||
data-content-script-id="${markdownIt.utils.escapeHtml(contentScriptId)}"
|
||||
class="post-message-link"
|
||||
>
|
||||
Click to post a message "justtesting" to plugin and check the response in the console
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
`;
|
||||
};
|
||||
},
|
||||
assets: function() {
|
||||
return [
|
||||
{ name: 'markdownItTestPlugin.css' },
|
||||
{ name: 'markdownItTestPluginRuntime.js' },
|
||||
];
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
const addClickHandlers = () => {
|
||||
const postMessageLinks = document.querySelectorAll('.post-message-link');
|
||||
for (const link of postMessageLinks) {
|
||||
const contentScriptId = link.getAttribute('data-content-script-id');
|
||||
link.onclick = async () => {
|
||||
const response = await webviewApi.postMessage(contentScriptId, 'justtesting');
|
||||
link.textContent = 'Got response in content script: ' + response;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('joplin-noteDidUpdate', () => {
|
||||
addClickHandlers();
|
||||
});
|
||||
在新工单中引用
屏蔽一个用户