release notes WIP

This commit is contained in:
Zsolt Viczian
2022-02-21 21:39:26 +01:00
parent 9c5331719b
commit 658c04401e
6 changed files with 1836 additions and 1706 deletions

View File

@@ -12,6 +12,7 @@ export class OneOffs {
this.plugin = plugin;
}
/*
public patchCommentBlock() {
//This is a once off cleanup process to remediate incorrectly placed comment %% before # Text Elements
if (!this.plugin.settings.patchCommentBlock) {
@@ -368,4 +369,5 @@ class ImageElementNotice extends Modal {
};
});
}
*/
}

75
src/ReleaseNotes.ts Normal file
View File

@@ -0,0 +1,75 @@
import { App, MarkdownRenderer, Modal } from "obsidian";
import ExcalidrawPlugin from "./main";
const RELEASE_NOTES: { [k: string]: string } = {
Intro: `I want to make it easier for you to keep up with all the updates.
Going forward, after installing each release, you'll be prompted with a message summarizing the key new features and fixes.
You can disable this in plugin-settings. The release change log is also avalable on [GitHub](https://github.com/zsviczian/obsidian-excalidraw-plugin/releases).
Since March 2021, I've spent most of my free time building this plugin. By now, this means well over 100 workdays worth of my time (assuming 8-hour days).
I am greatful to all of you who have already bought me a coffee. THANK YOU! This means a lot to me!
I still have many-many ideas for making Obsidian Excalidraw better.
I will continue to keep all the features of the plugin free. If, however, you'd like to contribute to the on-going development of the plugin, I am introducing a simple membership scheme, with Insider, Supporter and VIP tiers.
If you find this plugin valuable, please consider clicking the button below.
<div class="ex-coffee-div"><a href="https://ko-fi.com/zsolt"><img src="https://cdn.ko-fi.com/cdn/kofi3.png?v=3" height=45></a></div>
`,
"1.6.16":`
<div class="excalidraw-release-youtube" style="clear: both; text-align: center;">
<iframe height="100%" width="100%" src="https://www.youtube.com/embed/_c_0zpBJ4Xc?start=20" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>
## Fixed
- CMD+Drag does not work on Mac. You can now use SHIFT+Drag to embed an image or markdown document from the file Obsidian File Explorer into a scene.
## New Features
`};
export class ReleaseNotes extends Modal {
private plugin: ExcalidrawPlugin;
private version: string;
constructor(app: App, plugin: ExcalidrawPlugin, version: string) {
super(app);
this.plugin = plugin;
//@ts-ignore
this.version = version;
}
onOpen(): void {
this.contentEl.classList.add("excalidraw-release");
this.containerEl.classList.add(".excalidraw-release");
this.titleEl.setText(`Welcome to Excalidraw ${this.version}`);
this.createForm();
}
async onClose() {
this.contentEl.empty();
await this.plugin.loadSettings();
this.plugin.settings.previousRelease = this.version;
await this.plugin.saveSettings();
}
async createForm() {
const prevRelease = this.plugin.settings.previousRelease;
const message = Object
.keys(RELEASE_NOTES)
.filter(key=>key>prevRelease)
.map((key:string)=>`# ${key}\n${RELEASE_NOTES[key]}`)
.join("\n\n");
await MarkdownRenderer.renderMarkdown(
message,
this.contentEl,
"",
this.plugin,
);
this.contentEl.createEl("p", { text: "" }, (el) => {
//files manually follow one of two options:
el.style.textAlign = "right";
const bOk = el.createEl("button", { text: "Thank you!" });
bOk.onclick = () => this.close();
});
}
}

View File

@@ -75,6 +75,9 @@ export default {
CONVERT_FILE: "Convert to new format",
//settings.ts
RELEASE_NOTES_NAME: "Display Release Notes after update",
RELEASE_NOTES_DESC: "<b>Toggle ON:</b> Display release notes each time you update Excalidraw to a newer version.<br>" +
"<b>Toggle OFF:</b> Silent mode. You can still read release notes on [GitHub](https://github.com/zsviczian/obsidian-excalidraw-plugin/releases).",
FOLDER_NAME: "Excalidraw folder",
FOLDER_DESC:
"Default location for new drawings. If empty, drawings will be created in the Vault root.",

View File

@@ -74,7 +74,7 @@ import {
log,
sleep,
} from "./Utils";
import { OneOffs } from "./OneOffs";
//import { OneOffs } from "./OneOffs";
import { FileId } from "@zsviczian/excalidraw/types/element/types";
import { ScriptEngine } from "./Scripts";
import {
@@ -84,6 +84,7 @@ import {
observer,
} from "./MarkdownPostProcessor";
import { FieldSuggestor } from "./FieldSuggestor";
import { ReleaseNotes } from "./ReleaseNotes";
declare module "obsidian" {
interface App {
@@ -177,11 +178,14 @@ export default class ExcalidrawPlugin extends Plugin {
}
}
const patches = new OneOffs(this);
patches.migrationNotice();
patches.patchCommentBlock();
patches.wysiwygPatch();
patches.imageElementLaunchNotice();
// const patches = new OneOffs(this);
if(this.settings.showReleaseNotes) {
//@ts-ignore
const version:string = this.app.plugins.manifests["obsidian-excalidraw-plugin"].version;
if(version>this.settings.previousRelease) {
(new ReleaseNotes(this.app,this,version)).open();
}
}
this.switchToExcalidarwAfterLoad();

View File

@@ -74,6 +74,8 @@ export interface ExcalidrawSettings {
mdCSS: string;
scriptEngineSettings: {};
defaultTrayMode: boolean;
previousRelease: string;
showReleaseNotes: boolean;
}
export const DEFAULT_SETTINGS: ExcalidrawSettings = {
@@ -144,6 +146,8 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
mdCSS: "",
scriptEngineSettings: {},
defaultTrayMode: false,
previousRelease: "1.6.13",
showReleaseNotes: true,
};
const fragWithHTML = (html: string) =>
@@ -214,6 +218,18 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
});
coffeeImg.height = 45;
new Setting(containerEl)
.setName(t("RELEASE_NOTES_NAME"))
.setDesc(fragWithHTML(t("RELEASE_NOTES_DESC")))
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.showReleaseNotes)
.onChange(async (value) => {
this.plugin.settings.showReleaseNotes = value;
this.applySettingsUpdate();
}),
);
new Setting(containerEl)
.setName(t("FOLDER_NAME"))
.setDesc(fragWithHTML(t("FOLDER_DESC")))

View File

@@ -153,3 +153,33 @@ li[data-testid] {
.workspace-leaf-content .excalidraw-view {
padding: 0px 1px; /*1px so on ipad swipe in from left and right still works*/
}
.excalidraw-release-youtube {
width: 100%;
padding-top: 56.25%;
position: relative;
clear: both;
text-align: center;
max-width: 560px;
}
.excalidraw-release-youtube iframe {
position: absolute;
top:0;
left: 0;
bottom: 0;
right:0;
max-width: 560px;
max-height: 315px;
}
.excalidraw-release {
padding-right: 5px;
margin-right: -5px;
max-width: 130ch;
user-select: text;
}
.excalidraw-release .modal {
max-height:90%;
}