vault backup: 2025-02-27 21:31:55
This commit is contained in:
576
.obsidian/plugins/canvas2document/main.js
vendored
576
.obsidian/plugins/canvas2document/main.js
vendored
@@ -1,576 +0,0 @@
|
||||
/*
|
||||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||
if you want to view the source, please visit the github repository of this plugin
|
||||
*/
|
||||
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// main.ts
|
||||
var main_exports = {};
|
||||
__export(main_exports, {
|
||||
C2DSettingTab: () => C2DSettingTab,
|
||||
default: () => Canvas2DocumentPlugin
|
||||
});
|
||||
module.exports = __toCommonJS(main_exports);
|
||||
var import_obsidian = require("obsidian");
|
||||
var path = __toESM(require("path"));
|
||||
var DEFAULT_SETTINGS = {
|
||||
usefrontmatter: true,
|
||||
useedgelabels: true
|
||||
};
|
||||
var C2DSettingTab = class extends import_obsidian.PluginSettingTab {
|
||||
constructor(app, plugin) {
|
||||
super(app, plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
display() {
|
||||
let { containerEl } = this;
|
||||
containerEl.empty();
|
||||
new import_obsidian.Setting(containerEl).setName("Include YAML frontmatter from embedded documents").setDesc("Makes metadata from embedded documents usable in target document").addToggle(
|
||||
(toggle) => toggle.setValue(this.plugin.settings.usefrontmatter).onChange(async (value) => {
|
||||
this.plugin.settings.usefrontmatter = value;
|
||||
await this.plugin.saveSettings();
|
||||
})
|
||||
);
|
||||
new import_obsidian.Setting(containerEl).setName("Include labels of canvas elements").setDesc("Makes connections descriptions usable in target document").addToggle(
|
||||
(toggle) => toggle.setValue(this.plugin.settings.useedgelabels).onChange(async (value) => {
|
||||
this.plugin.settings.useedgelabels = value;
|
||||
await this.plugin.saveSettings();
|
||||
})
|
||||
);
|
||||
}
|
||||
};
|
||||
var Canvas2DocumentPlugin = class extends import_obsidian.Plugin {
|
||||
async onload() {
|
||||
await this.loadSettings();
|
||||
this.addSettingTab(new C2DSettingTab(this.app, this));
|
||||
if (this.app.vault.adapter instanceof import_obsidian.FileSystemAdapter) {
|
||||
this.fsadapter = this.app.vault.adapter;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
this.addCommand({
|
||||
id: "run-conversion",
|
||||
name: "Step 1 - Convert canvas to a longform document",
|
||||
callback: async () => {
|
||||
const canvStruct = await this.readCanvasStruct();
|
||||
if (canvStruct == false) {
|
||||
new import_obsidian.Notice(`this is not a canvas file`);
|
||||
return;
|
||||
}
|
||||
let [contents, myparsed_data] = await this.readCanvasData(canvStruct);
|
||||
const result = await this.writeCanvDocFile(contents, canvStruct, myparsed_data);
|
||||
}
|
||||
});
|
||||
this.addCommand({
|
||||
id: "run-redoc",
|
||||
name: "Step 2 - Clear canvas2document target document",
|
||||
callback: async () => {
|
||||
const canvStruct = await this.readC2Dtarget();
|
||||
if (canvStruct == false) {
|
||||
new import_obsidian.Notice(`this is not a canvas2document target file`);
|
||||
return;
|
||||
}
|
||||
this.writeC2Doc(canvStruct);
|
||||
}
|
||||
});
|
||||
this.addRibbonIcon("image-down", "C2D Step 1 - Convert Canvas to draft doc", () => {
|
||||
this.app.commands.executeCommandById("canvas2document:run-conversion");
|
||||
});
|
||||
this.addRibbonIcon("file-input", "C2D Step 2 - Make cleared document", () => {
|
||||
this.app.commands.executeCommandById("canvas2document:run-redoc");
|
||||
});
|
||||
}
|
||||
async loadSettings() {
|
||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||
}
|
||||
async saveSettings() {
|
||||
await this.saveData(this.settings);
|
||||
}
|
||||
onunload() {
|
||||
}
|
||||
async readC2Dtarget() {
|
||||
let activeFile = this.app.workspace.getActiveFile();
|
||||
if (!activeFile || !activeFile.name.includes("_fromCanvas.md")) {
|
||||
return false;
|
||||
} else {
|
||||
let mdFolderPath = path.dirname(activeFile.path);
|
||||
}
|
||||
let content = this.app.vault.cachedRead(activeFile);
|
||||
return content;
|
||||
}
|
||||
async writeC2Doc(canvStruct) {
|
||||
let activeFile = this.app.workspace.getActiveFile();
|
||||
let mdFolderPath = path.dirname(activeFile.path);
|
||||
const regex = /\!\[\[([^[\]]+)\]\]|<iframe\s+[^>]*src="(.*?)"/g;
|
||||
const matches = [];
|
||||
let match;
|
||||
while ((match = regex.exec(canvStruct)) !== null) {
|
||||
if (match[1]) {
|
||||
matches.push(match[1]);
|
||||
} else if (match[2]) {
|
||||
matches.push(match[2]);
|
||||
}
|
||||
}
|
||||
const edgelabelpattern = /<edgelabel\s+(?:data="(.*?)")?>(.*?)<\/edgelabel>/g;
|
||||
const matchesedgelabel = [];
|
||||
let matchel;
|
||||
while ((matchel = edgelabelpattern.exec(canvStruct)) !== null) {
|
||||
matchesedgelabel.push({
|
||||
data: matchel[1],
|
||||
// Captured `data` attribute (optional)
|
||||
content: matchel[2]
|
||||
// Captured inner content
|
||||
});
|
||||
}
|
||||
let doccontentstring = "> [!success] This is your converted and cleared document from Canvas2Document\n> (you can delete this infobox)\n\n";
|
||||
if (!matches) {
|
||||
return;
|
||||
}
|
||||
let textfilenames = [];
|
||||
let filenames = [];
|
||||
matches.forEach((match2) => {
|
||||
let embeddedfilename = match2.replace(/\!\[\[(.*)\]\]/, "$1");
|
||||
if (embeddedfilename.endsWith(".md")) {
|
||||
if (embeddedfilename.startsWith("./")) {
|
||||
embeddedfilename = embeddedfilename.replace("./", "");
|
||||
}
|
||||
textfilenames.push(embeddedfilename);
|
||||
}
|
||||
filenames.push(embeddedfilename);
|
||||
});
|
||||
const fileContents = await Promise.all(
|
||||
textfilenames.map(
|
||||
async (file) => [file, await this.app.vault.cachedRead(this.app.vault.getAbstractFileByPath(file))]
|
||||
)
|
||||
);
|
||||
for (const xfile of filenames) {
|
||||
if (this.settings.useedgelabels) {
|
||||
matchesedgelabel.forEach((label) => {
|
||||
if (xfile === label.data) {
|
||||
doccontentstring += '> [!info] (edge label in canvas for the following entry:) "' + label.content + '"\n\n';
|
||||
}
|
||||
});
|
||||
}
|
||||
if (xfile.endsWith(".md")) {
|
||||
const found = fileContents.find((element) => element[0] == xfile);
|
||||
const { dir, name, ext } = path.parse(xfile);
|
||||
if (!dir.endsWith("_canvas2doc-data")) {
|
||||
doccontentstring += "# " + name + "\n\n";
|
||||
}
|
||||
const frontMatterInfo = (0, import_obsidian.getFrontMatterInfo)(found[1]);
|
||||
let textfilestring = "";
|
||||
if (this.settings.usefrontmatter && frontMatterInfo.exists) {
|
||||
textfilestring = found[1].substring(frontMatterInfo.contentStart);
|
||||
} else {
|
||||
textfilestring = found[1];
|
||||
}
|
||||
doccontentstring += textfilestring + "\n\n";
|
||||
} else if (xfile.startsWith("http")) {
|
||||
doccontentstring += '<iframe width=500 height=300 src="' + xfile + '"></iframe>\n\n';
|
||||
} else {
|
||||
doccontentstring += "![[" + xfile + "]]\n\n";
|
||||
}
|
||||
}
|
||||
let docFilename;
|
||||
if (mdFolderPath == ".") {
|
||||
docFilename = activeFile.basename + "_fromC2D.md";
|
||||
} else {
|
||||
docFilename = mdFolderPath + "/" + activeFile.basename + "_fromC2D.md";
|
||||
}
|
||||
try {
|
||||
const exists = await this.fsadapter.exists(docFilename);
|
||||
if (exists) {
|
||||
const confirmed = await new Promise((resolve) => {
|
||||
const notice = new import_obsidian.Notice("File " + docFilename + " already exists. Overwrite?", 0);
|
||||
notice.noticeEl.createEl("button", { text: "Yes" }).onclick = () => {
|
||||
notice.hide();
|
||||
resolve(true);
|
||||
};
|
||||
notice.noticeEl.createEl("button", { text: "No" }).onclick = () => {
|
||||
notice.hide();
|
||||
resolve(false);
|
||||
};
|
||||
});
|
||||
if (!confirmed) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
await this.fsadapter.write(docFilename, doccontentstring);
|
||||
} catch (e) {
|
||||
console.log("error writing the new cleared doc file " + e);
|
||||
}
|
||||
const docftab = await this.app.vault.getAbstractFileByPath(docFilename);
|
||||
try {
|
||||
await this.app.workspace.getLeaf("split").openFile(docftab);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
async readCanvasStruct() {
|
||||
let activeFile = this.app.workspace.getActiveFile();
|
||||
if (!activeFile || activeFile.extension != "canvas") {
|
||||
return false;
|
||||
} else {
|
||||
let mdFolderPath = path.dirname(activeFile.path);
|
||||
}
|
||||
let content = this.app.vault.cachedRead(activeFile);
|
||||
return content;
|
||||
}
|
||||
async findAllXChildren(startGeneration, myparsed_data, fileContents, handledNodes, limitrecurseNodes, runcounterfunc, runcounterforeach) {
|
||||
runcounterfunc++;
|
||||
if (runcounterfunc > 30) {
|
||||
return false;
|
||||
}
|
||||
for (const child of startGeneration) {
|
||||
runcounterforeach++;
|
||||
if (runcounterforeach > myparsed_data.edges2.length) {
|
||||
return false;
|
||||
}
|
||||
const nodeentry = myparsed_data.nodes.find((entry) => entry.id === child);
|
||||
if (!handledNodes.has(child)) {
|
||||
const result = await this.formatNode(nodeentry, 6);
|
||||
fileContents.push(result);
|
||||
handledNodes.add(child);
|
||||
} else {
|
||||
limitrecurseNodes++;
|
||||
if (limitrecurseNodes > 30) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
let children = myparsed_data.edges2.filter((edge) => edge.fromNode === child).map((edge) => edge.toNode);
|
||||
if (children.length > 0) {
|
||||
const continueRecursion = await this.findAllXChildren(children, myparsed_data, fileContents, handledNodes, limitrecurseNodes, runcounterfunc, runcounterforeach);
|
||||
if (!continueRecursion)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
;
|
||||
limitrecurseNodes++;
|
||||
return limitrecurseNodes <= 30;
|
||||
}
|
||||
async traverseNodes(initialNodes, myparsed_data, fileContents, handledNodes) {
|
||||
for (const node of initialNodes) {
|
||||
const nodeentry = myparsed_data.nodes.find((entry) => entry.id === node);
|
||||
if (!handledNodes.has(node)) {
|
||||
const result = await this.formatNode(nodeentry, 1);
|
||||
fileContents.push(result);
|
||||
}
|
||||
handledNodes.add(node);
|
||||
const children1 = myparsed_data.edges2.filter((edge) => edge.fromNode === node).map((edge) => edge.toNode);
|
||||
for (const child1 of children1) {
|
||||
const nodeentry2 = myparsed_data.nodes.find((entry) => entry.id === child1);
|
||||
if (!handledNodes.has(child1)) {
|
||||
const result = await this.formatNode(nodeentry2, 2);
|
||||
fileContents.push(result);
|
||||
}
|
||||
handledNodes.add(child1);
|
||||
const children2 = myparsed_data.edges2.filter((edge) => edge.fromNode === child1).map((edge) => edge.toNode);
|
||||
for (const child2 of children2) {
|
||||
const nodeentry3 = myparsed_data.nodes.find((entry) => entry.id === child2);
|
||||
if (!handledNodes.has(child2)) {
|
||||
const result = await this.formatNode(nodeentry3, 3);
|
||||
fileContents.push(result);
|
||||
}
|
||||
handledNodes.add(child2);
|
||||
const children3 = myparsed_data.edges2.filter((edge) => edge.fromNode === child2).map((edge) => edge.toNode);
|
||||
for (const child3 of children3) {
|
||||
const nodeentry4 = myparsed_data.nodes.find((entry) => entry.id === child3);
|
||||
if (!handledNodes.has(child3)) {
|
||||
const result = await this.formatNode(nodeentry4, 4);
|
||||
fileContents.push(result);
|
||||
}
|
||||
handledNodes.add(child3);
|
||||
const children4 = myparsed_data.edges2.filter((edge) => edge.fromNode === child3).map((edge) => edge.toNode);
|
||||
for (const child4 of children4) {
|
||||
const nodeentry5 = myparsed_data.nodes.find((entry) => entry.id === child4);
|
||||
if (!handledNodes.has(child4)) {
|
||||
const result = await this.formatNode(nodeentry5, 5);
|
||||
fileContents.push(result);
|
||||
}
|
||||
handledNodes.add(child4);
|
||||
const children5 = myparsed_data.edges2.filter((edge) => edge.fromNode === child4).map((edge) => edge.toNode);
|
||||
for (const child5 of children5) {
|
||||
const nodeentry6 = myparsed_data.nodes.find((entry) => entry.id === child5);
|
||||
if (!handledNodes.has(child5)) {
|
||||
const result2 = await this.formatNode(nodeentry6, 6);
|
||||
fileContents.push(result2);
|
||||
}
|
||||
handledNodes.add(child5);
|
||||
const children6 = myparsed_data.edges2.filter((edge) => edge.fromNode === child5).map((edge) => edge.toNode);
|
||||
let runcounterfunc = 0;
|
||||
let runcounterforeach = 0;
|
||||
let limitrecurseNodes = 0;
|
||||
const result = await this.findAllXChildren(children6, myparsed_data, fileContents, handledNodes, limitrecurseNodes, runcounterfunc, runcounterforeach);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
async readCanvasData(struct) {
|
||||
const fileContents = [];
|
||||
let myparsed_data = JSON.parse(struct);
|
||||
const singleNodeIDs = /* @__PURE__ */ new Set();
|
||||
const groupNodes = /* @__PURE__ */ new Set();
|
||||
myparsed_data.nodes.forEach((node) => {
|
||||
if (node.type === "group") {
|
||||
groupNodes.add(node.id);
|
||||
} else {
|
||||
singleNodeIDs.add(node.id);
|
||||
}
|
||||
});
|
||||
const fromNodes = /* @__PURE__ */ new Set();
|
||||
const toNodes = /* @__PURE__ */ new Set();
|
||||
let groupClearedEdges = [];
|
||||
let resa = await myparsed_data.edges.forEach((edge) => {
|
||||
if (groupNodes.has(edge.fromNode) || groupNodes.has(edge.toNode)) {
|
||||
} else {
|
||||
fromNodes.add(edge.fromNode);
|
||||
toNodes.add(edge.toNode);
|
||||
groupClearedEdges.push(edge);
|
||||
}
|
||||
});
|
||||
myparsed_data.edges2 = groupClearedEdges;
|
||||
let handledNodes = /* @__PURE__ */ new Set();
|
||||
const skiphandledNodes = true;
|
||||
let nodesWithoutParents = [...singleNodeIDs].filter((node) => !toNodes.has(node));
|
||||
if (nodesWithoutParents.length === 0) {
|
||||
nodesWithoutParents = [...singleNodeIDs];
|
||||
}
|
||||
const traverseresult = await this.traverseNodes(nodesWithoutParents, myparsed_data, fileContents, handledNodes);
|
||||
const diff = new Set([...singleNodeIDs].filter((x) => !handledNodes.has(x)));
|
||||
if (diff.size > 0) {
|
||||
const traverseresult2 = await this.traverseNodes(diff, myparsed_data, fileContents, handledNodes);
|
||||
}
|
||||
return [fileContents, myparsed_data];
|
||||
}
|
||||
async formatNode(node, level) {
|
||||
const id = node.id;
|
||||
const type = node.type;
|
||||
let nodefile = "";
|
||||
if (type === "file") {
|
||||
nodefile = node.file;
|
||||
const { name, ext } = path.parse(nodefile);
|
||||
if (ext === ".md") {
|
||||
return [id, type, nodefile, level, "textfile", name];
|
||||
} else if (ext === ".canvas") {
|
||||
return [id, type, nodefile, level, "embeddedcanvas", name];
|
||||
} else if (ext === ".jpg" || ext == ".jpeg" || ext === ".png" || ext === ".gif") {
|
||||
return [id, type, nodefile, level, "contentimage", name + "." + ext];
|
||||
} else if (ext === ".mp3" || ext === ".wav" || ext === ".ogg") {
|
||||
return [id, type, nodefile, level, "contentaudio", name + "." + ext];
|
||||
} else if (ext === ".mp4" || ext === ".webm") {
|
||||
return [id, type, nodefile, level, "contentvideo", name + "." + ext];
|
||||
} else if (ext === ".pdf") {
|
||||
return [id, type, nodefile, level, "contentpdf", name + "." + ext];
|
||||
} else {
|
||||
return [id, type, nodefile, level, "xfile", name + "." + ext];
|
||||
}
|
||||
} else if (type === "link") {
|
||||
if (node.url.includes("youtube")) {
|
||||
const url = node.url;
|
||||
return [id, type, url, level, "contentyoutube", node.url];
|
||||
} else {
|
||||
return [id, type, node.url, level, "contentlink", node.url];
|
||||
}
|
||||
} else if (type === "text") {
|
||||
const text = node.text;
|
||||
const textPreview = text.substring(0, 100);
|
||||
return [id, type, "node", level, text, textPreview];
|
||||
}
|
||||
}
|
||||
async writeCanvDocFile(content, convStruct, myparsed_data) {
|
||||
let activeFile = this.app.workspace.getActiveFile();
|
||||
let mdFolderPath = path.dirname(activeFile.path);
|
||||
let writeworkdir = mdFolderPath + "/" + activeFile.basename + "_canvas2doc-data";
|
||||
this.fsadapter.mkdir(writeworkdir);
|
||||
let canvasFile;
|
||||
let canvasFilename;
|
||||
if (mdFolderPath == ".") {
|
||||
canvasFilename = activeFile.basename + "_fromCanvas.md";
|
||||
} else {
|
||||
canvasFilename = mdFolderPath + "/" + activeFile.basename + "_fromCanvas.md";
|
||||
}
|
||||
let contentString = "> [!info] This is an automatically generated document from Plugin [Canvas2Document](https://github.com/slnsys/obsidian-canvas2document)\n> arrange the document as you need with the outline, then call *Clear canvas2document target document*\n\n";
|
||||
for (const element of content) {
|
||||
let cnfname = "";
|
||||
let heading = "";
|
||||
for (let i = 0; i < element[3]; i++) {
|
||||
heading += "#";
|
||||
}
|
||||
if (element[1] == "text") {
|
||||
cnfname = writeworkdir + "/newdoc-node_" + element[0] + "_fromCanvas.md";
|
||||
contentString += "\n\n" + heading + " _card " + element[5] + "\n";
|
||||
contentString += element[2] + " ^" + element[0] + "\n\n";
|
||||
contentString += "> [!tip] link navigation from the canvas\n";
|
||||
for (const edge of myparsed_data.edges2) {
|
||||
if (edge.fromNode == element[0]) {
|
||||
const found = content.find((element2) => element2[0] == edge.toNode);
|
||||
const firstline = found[5].split("\n")[0];
|
||||
const found5 = firstline.replace(/#/g, "");
|
||||
contentString += "> linking to: [[#^" + edge.toNode + "|" + found5 + "]]\n";
|
||||
}
|
||||
if (edge.toNode == element[0]) {
|
||||
const found = content.find((element2) => element2[0] == edge.fromNode);
|
||||
const firstline = found[5].split("\n")[0];
|
||||
const found5 = firstline.replace(/#/g, "");
|
||||
if (edge.label != void 0) {
|
||||
contentString += "> linked from: [[#^" + edge.fromNode + "|" + found5 + ']] ("<edgelabel data="' + cnfname + '">' + edge.label + '</edgelabel>")\n';
|
||||
} else {
|
||||
contentString += "> linked from: [[#^" + edge.fromNode + "|" + found5 + "]]\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
contentString += "\n ![[" + cnfname + "]]\n\n";
|
||||
let canvasnodeFile;
|
||||
try {
|
||||
let cnfabst2 = this.app.vault.getAbstractFileByPath(cnfname);
|
||||
await this.fsadapter.write(cnfname, element[4]);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
return;
|
||||
}
|
||||
} else if (element[1] == "link") {
|
||||
contentString += "\n\n" + heading + " _link " + element[5] + "\n";
|
||||
contentString += element[2] + " ^" + element[0] + "\n\n";
|
||||
contentString += "> [!tip] link navigation from the canvas\n";
|
||||
for (const edge of myparsed_data.edges2) {
|
||||
if (edge.fromNode == element[0]) {
|
||||
const found = content.find((element2) => element2[0] == edge.toNode);
|
||||
const firstline = found[5].split("\n")[0];
|
||||
const found5 = firstline.replace(/#/g, "");
|
||||
contentString += "> linking to: [[#^" + edge.toNode + "|" + found5 + "]]\n";
|
||||
}
|
||||
if (edge.toNode == element[0]) {
|
||||
const found = content.find((element2) => element2[0] == edge.fromNode);
|
||||
const firstline = found[5].split("\n")[0];
|
||||
const found5 = firstline.replace(/#/g, "");
|
||||
if (edge.label != void 0) {
|
||||
contentString += "> linked from: [[#^" + edge.fromNode + "|" + found5 + ']] ("<edgelabel data="' + element[2] + '">' + edge.label + '</edgelabel>")\n';
|
||||
} else {
|
||||
contentString += "> linked from: [[#^" + edge.fromNode + "|" + found5 + "]]\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (element[4] == "contentyoutube") {
|
||||
contentString += "\n \n\n";
|
||||
} else if (element[4] == "contentlink") {
|
||||
contentString += '\n <iframe width=500 height=300 src="' + element[2] + '"></iframe>\n\n';
|
||||
}
|
||||
} else if (element[1] == "file") {
|
||||
if (element[4] == "contentimage" || element[4] == "contentpdf") {
|
||||
contentString += "\n\n" + heading + " _Media " + element[5] + "\n";
|
||||
contentString += element[2] + " ^" + element[0] + "\n\n";
|
||||
contentString += "> [!tip] link navigation from the canvas\n";
|
||||
for (const edge of myparsed_data.edges2) {
|
||||
if (edge.fromNode == element[0]) {
|
||||
const found = content.find((element2) => element2[0] == edge.toNode);
|
||||
const firstline = found[5].split("\n")[0];
|
||||
const found5 = firstline.replace(/#/g, "");
|
||||
contentString += "> linking to: [[#^" + edge.toNode + "|" + found5 + "]]\n";
|
||||
}
|
||||
if (edge.toNode == element[0]) {
|
||||
const found = content.find((element2) => element2[0] == edge.fromNode);
|
||||
const firstline = found[5].split("\n")[0];
|
||||
const found5 = firstline.replace(/#/g, "");
|
||||
if (edge.label != void 0) {
|
||||
contentString += "> linked from: [[#^" + edge.fromNode + "|" + found5 + ']] ("<edgelabel data="' + element[2] + '">' + edge.label + '</edgelabel>")\n';
|
||||
} else {
|
||||
contentString += "> linked from: [[#^" + edge.fromNode + "|" + found5 + "]]\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (element[4] == "contentpdf") {
|
||||
contentString += "\n ![[" + element[2] + "]]\n\n";
|
||||
} else if (element[4] == "contentimage") {
|
||||
contentString += "\n ![[" + element[2] + "]]\n\n";
|
||||
}
|
||||
} else {
|
||||
contentString += "\n\n" + heading + " _noteFile " + element[5] + "\n";
|
||||
contentString += element[2] + " ^" + element[0] + "\n\n";
|
||||
contentString += "> [!tip] link navigation from the canvas\n";
|
||||
for (const edge of myparsed_data.edges2) {
|
||||
if (edge.fromNode == element[0]) {
|
||||
const found = content.find((element2) => element2[0] == edge.toNode);
|
||||
const firstline = found[5].split("\n")[0];
|
||||
const found5 = firstline.replace(/#/g, "");
|
||||
contentString += "> linking to: [[#^" + edge.toNode + "|" + found5 + "]]\n";
|
||||
}
|
||||
if (edge.toNode == element[0]) {
|
||||
const found = content.find((element2) => element2[0] == edge.fromNode);
|
||||
const firstline = found[5].split("\n")[0];
|
||||
const found5 = firstline.replace(/#/g, "");
|
||||
if (edge.label != void 0) {
|
||||
contentString += "> linked from: [[#^" + edge.fromNode + "|" + found5 + ']] ("<edgelabel data="' + element[2] + '">' + edge.label + '</edgelabel>")\n';
|
||||
} else {
|
||||
contentString += "> linked from: [[#^" + edge.fromNode + "|" + found5 + "]]\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
contentString += "\n ![[" + element[2] + "]]\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
const exists = await this.fsadapter.exists(canvasFilename);
|
||||
if (exists) {
|
||||
const confirmed = await new Promise((resolve) => {
|
||||
const notice = new import_obsidian.Notice("File " + canvasFilename + " already exists. Overwrite?", 0);
|
||||
notice.noticeEl.createEl("button", { text: "Yes" }).onclick = () => {
|
||||
notice.hide();
|
||||
resolve(true);
|
||||
};
|
||||
notice.noticeEl.createEl("button", { text: "No" }).onclick = () => {
|
||||
notice.hide();
|
||||
resolve(false);
|
||||
};
|
||||
});
|
||||
if (!confirmed) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
await this.fsadapter.write(canvasFilename, contentString);
|
||||
} catch (e) {
|
||||
console.log("error writing the new doc file " + e);
|
||||
}
|
||||
const cnfabst = await this.app.vault.getAbstractFileByPath(canvasFilename);
|
||||
try {
|
||||
await this.app.workspace.getLeaf("split").openFile(cnfabst);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* nosourcemap */
|
||||
10
.obsidian/plugins/canvas2document/manifest.json
vendored
10
.obsidian/plugins/canvas2document/manifest.json
vendored
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"id": "canvas2document",
|
||||
"name": "Canvas2Document",
|
||||
"version": "1.3.0",
|
||||
"minAppVersion": "1.5.12",
|
||||
"description": "Convert a complete Canvas to a long form document, integrating all cards, notes, images and other media content into a single markdown file.",
|
||||
"author": "slnsys",
|
||||
"authorUrl": "https://github.com/slnsys",
|
||||
"isDesktopOnly": true
|
||||
}
|
||||
481
.obsidian/plugins/obsidian-git/main.js
vendored
481
.obsidian/plugins/obsidian-git/main.js
vendored
File diff suppressed because one or more lines are too long
2
.obsidian/plugins/obsidian-git/manifest.json
vendored
2
.obsidian/plugins/obsidian-git/manifest.json
vendored
@@ -6,5 +6,5 @@
|
||||
"description": "Integrate Git version control with automatic backup and other advanced features.",
|
||||
"isDesktopOnly": false,
|
||||
"fundingUrl": "https://ko-fi.com/vinzent",
|
||||
"version": "2.30.1"
|
||||
"version": "2.31.1"
|
||||
}
|
||||
|
||||
10
.obsidian/plugins/obsidian-git/styles.css
vendored
10
.obsidian/plugins/obsidian-git/styles.css
vendored
@@ -564,3 +564,13 @@
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.git-unified-diff-view,
|
||||
.git-split-diff-view .cm-deletedLine .cm-changedText {
|
||||
background-color: #ee443330;
|
||||
}
|
||||
|
||||
.git-unified-diff-view,
|
||||
.git-split-diff-view .cm-insertedLine .cm-changedText {
|
||||
background-color: #22bb2230;
|
||||
}
|
||||
|
||||
@@ -6834,7 +6834,7 @@ class IconizePlugin extends obsidian.Plugin {
|
||||
return;
|
||||
}
|
||||
for (const openedFile of getAllOpenedFiles(this)) {
|
||||
if (openedFile.path !== file.path) {
|
||||
if (!file || !openedFile || openedFile.path !== file.path) {
|
||||
continue;
|
||||
}
|
||||
const leaf = openedFile.leaf.view;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "obsidian-icon-folder",
|
||||
"name": "Iconize",
|
||||
"version": "2.14.6",
|
||||
"version": "2.14.7",
|
||||
"minAppVersion": "0.9.12",
|
||||
"description": "Add icons to anything you desire in Obsidian, including files, folders, and text.",
|
||||
"author": "Florian Woelki",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
.iconize-inline-title-wrapper {
|
||||
width: var(--line-width);
|
||||
max-width: var(--max-width);
|
||||
margin-inline: var(--content-margin);
|
||||
}
|
||||
|
||||
|
||||
64
.obsidian/workspace.json
vendored
64
.obsidian/workspace.json
vendored
@@ -43,8 +43,8 @@
|
||||
"state": {
|
||||
"file": "WORK & PROJECTS/Mol/Серверы/Alfa cloud prod.canvas",
|
||||
"viewState": {
|
||||
"x": 1691.8296379380579,
|
||||
"y": 498.264615441563,
|
||||
"x": 1274.566899224297,
|
||||
"y": 353.4356527657129,
|
||||
"zoom": -1.666666600439286
|
||||
}
|
||||
},
|
||||
@@ -205,51 +205,53 @@
|
||||
"templates:Insert template": false,
|
||||
"command-palette:Open command palette": false,
|
||||
"obsidian-full-calendar:Open Full Calendar": false,
|
||||
"obsidian-git:Open Git source control": false
|
||||
"obsidian-git:Open Git source control": false,
|
||||
"canvas2document:C2D Step 1 - Convert Canvas to draft doc": false,
|
||||
"canvas2document:C2D Step 2 - Make cleared document": false
|
||||
}
|
||||
},
|
||||
"active": "4e37f7bc6712d830",
|
||||
"active": "221c41e61c302338",
|
||||
"lastOpenFiles": [
|
||||
"conflict-files-obsidian-git.md",
|
||||
"WORK & PROJECTS/Mol/Ideas/Все идеи для Моли.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod.canvas",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_fromCanvas_fromC2D.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_b9a89b6c704bbab9_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_22120c2e0489d623_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_9ac7fb4c1839d1c1_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_16563c8fe55a26fe_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_be85b0f0c9d7c5c9_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_d0967a61e8872474_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_818ff03ad9e41a66_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_339642f454dec00c_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_15fc914984515332_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_90d44e64ab154a1a_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_546742f58a9feb77_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_1e42b8aa516bc15d_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_7bb34343b485f669_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_7f1ca2cda9e89951_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_ea6f72ceae655889_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_72b797b472986e84_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_7ae28a819183d708_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_2b6e0e1051629348_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_6ed5eab6b8e16f3b_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_ac17a82fee50447b_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_16f08ef6b7358e0b_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_88e977d27b7f415c_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data/newdoc-node_f3d0e9a6d4d8e6a7_fromCanvas.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod_canvas2doc-data",
|
||||
"WORK & PROJECTS/Mol/Документы для ТЗ ЛИМС/~$ ЛИМС 10-02-25 (2).docx",
|
||||
"WORK & PROJECTS/Mol/Документы для ТЗ ЛИМС/СПБ-ВетЛаб ТЗ ЛИМС 10-02-25.docx",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa cloud prod.canvas",
|
||||
"WORK & PROJECTS/Mol/Серверы/Alfa prod.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Jira - Service - Confluence - Crm.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/Схема инфраструктуры.canvas",
|
||||
"WORK & PROJECTS/Mol/Серверы/VPN-FIREWALL-GATE (Cerberus).md",
|
||||
"WORK & PROJECTS/Mol/Документы для ТЗ ЛИМС/АФ-01 Альбом форм.pdf",
|
||||
"WORK & PROJECTS/Mol/Документы для ТЗ ЛИМС/ГОСТ 17025 2019.pdf",
|
||||
"WORK & PROJECTS/Mol/Планы и диаграммы/00001_Редактор_форм/Архитектура редактора и генератора (Alfa + Mol).canvas",
|
||||
"WORK & PROJECTS/Mol/Планы и диаграммы/СМК.md",
|
||||
"WORK & PROJECTS/Mol/Планы и диаграммы/План СИЛА.md",
|
||||
"WORK & PROJECTS/Mol/Планы и диаграммы/План разработки.md",
|
||||
"WORK & PROJECTS/Mol/Планы и диаграммы/1.0/1.0.md",
|
||||
"WORK & PROJECTS/Mol/Планы и диаграммы/00001_Быстрый старт/Быстрый старт.canvas",
|
||||
"SKILLS DOCS/OLD PHP INSTALL.md",
|
||||
"WORK & PROJECTS/Ulab/Доступы к точкам.md",
|
||||
"WORK & PROJECTS/Mol/Планы и диаграммы/ALFA 1.0",
|
||||
"WORK & PROJECTS/Mol/Серверы/00_Список серверов.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/git.moldev.ru.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/access.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/1С Бухгалтерия.md",
|
||||
"WORK & PROJECTS/Mol/Планы и диаграммы/00001_Быстрый старт/Быстрый старт план.md",
|
||||
"WORK & PROJECTS/Mol/Планы и диаграммы/00001_Редактор_форм",
|
||||
"WORK & PROJECTS/Mol/Планы и диаграммы/00001_Быстрый старт",
|
||||
"WORK & PROJECTS/Mol/Серверы/mol-desk.mol-soft.PRODs.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/mail.mol-soft.ru.md",
|
||||
"PERSONAL PROJECTS/P2EP/cdRead.canvas",
|
||||
"WORK & PROJECTS/Mol/Документы для ТЗ ЛИМС/С категориями/~$Критерии_оценки_поставщика_ЛИМС_Газпром-Нефть.xlsx",
|
||||
"WORK & PROJECTS/Mol/Документы для ТЗ ЛИМС/С категориями/ЛИМС_Опросный_лист_по_ФТТ_от_21_10_2024_для_Исполнителя.XLSX",
|
||||
"WORK & PROJECTS/Mol/Документы для ТЗ ЛИМС/С категориями/Критерии_оценки_поставщика_ЛИМС_Газпром-Нефть.xlsx",
|
||||
"WORK & PROJECTS/Mol/Серверы/moldev.ru.md",
|
||||
"WORK & PROJECTS/Mol/Ideas/Организационные идеи.md",
|
||||
"WORK & PROJECTS/Mol/Ideas/Технические идеи.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/crm.mol-soft.ru.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/DOCS/Load Balancer 2.md",
|
||||
"WORK & PROJECTS/Mol/Серверы/DOCS/Load Balancer.md",
|
||||
"WORK & PROJECTS/Ulab/Aspro_docs/01.md",
|
||||
"P2EP/cdRead.canvas",
|
||||
"WORK & PROJECTS/img/Pasted image 20241212175419.png",
|
||||
"WORK & PROJECTS/img/Pasted image 20241212175847.png",
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
liquibase update
|
||||
@@ -0,0 +1 @@
|
||||
📂cache bitrix
|
||||
@@ -0,0 +1 @@
|
||||
📂doc_archive
|
||||
@@ -0,0 +1 @@
|
||||
CLOUD API
|
||||
@@ -0,0 +1 @@
|
||||
📂doc_archive
|
||||
@@ -0,0 +1 @@
|
||||
# 🗄 git.moldev.ru
|
||||
@@ -0,0 +1 @@
|
||||
Обновляемые конфиги
|
||||
@@ -0,0 +1 @@
|
||||
📂doc_archive
|
||||
@@ -0,0 +1 @@
|
||||
📂bitrix sources
|
||||
@@ -0,0 +1 @@
|
||||
**Cloud Users DB**
|
||||
@@ -0,0 +1 @@
|
||||
client2 apache reverse proxy
|
||||
@@ -0,0 +1,32 @@
|
||||
### CLOUD API (конфигурация облаков)
|
||||
- #### Регистрация нового клиента
|
||||
- создание новой БД клиента из CLEAN_db
|
||||
- внесение данных о клиенте в БД клиента
|
||||
- обновление cloud_users_db
|
||||
- поддомен и статус ssl-сертификатов
|
||||
- рабочий сервер
|
||||
- рабочая папка на сервере
|
||||
- настройки контейнера (подключенные модули, версия кода и тд)
|
||||
- тариф и крайняя дата исп.
|
||||
- БД
|
||||
- Часовой пояс
|
||||
- Информация о логине первого пользователя
|
||||
- переконфигурация сервера
|
||||
- создание/конфигурация файлов кэша, настроек php и индивидуальных архивов
|
||||
- пересоздание/обновление конфигов:
|
||||
- docker
|
||||
- apache
|
||||
- скрипт обновления БД (liquibase)
|
||||
- выпуск ssl нового поддомена
|
||||
- перезапуск apache & docker compose
|
||||
- #### Обновление информации клиента
|
||||
- тариф и дата последнего дня работы
|
||||
- подключённые опции (реконфиг docker)
|
||||
- часовой пояс php
|
||||
- #### Работа с демо-данными
|
||||
- активация демо-данных
|
||||
- удаление демо-данных
|
||||
- #### Удаление клиента
|
||||
- очистка БД клиента
|
||||
- пересоздание конфигов сервера
|
||||
- чистка файлов (контейнеры и конфиги)
|
||||
@@ -0,0 +1 @@
|
||||
Клиентские БД
|
||||
@@ -0,0 +1 @@
|
||||
Папки клиентских данных
|
||||
@@ -0,0 +1 @@
|
||||
📂cache bitrix
|
||||
@@ -0,0 +1,2 @@
|
||||
client 1
|
||||
apache + php container
|
||||
@@ -0,0 +1 @@
|
||||
client3 apache reverse proxy
|
||||
@@ -0,0 +1 @@
|
||||
DEMO_DATA_db
|
||||
@@ -0,0 +1 @@
|
||||
apache cloud API conf
|
||||
@@ -0,0 +1 @@
|
||||
client2_db
|
||||
@@ -0,0 +1,2 @@
|
||||
client 2
|
||||
apache + php container
|
||||
@@ -0,0 +1 @@
|
||||
1C:CRM API
|
||||
@@ -0,0 +1 @@
|
||||
sql all bases update .sh script
|
||||
@@ -0,0 +1 @@
|
||||
CLOUD API
|
||||
@@ -0,0 +1 @@
|
||||
📂alfa sources (.git)
|
||||
@@ -0,0 +1 @@
|
||||
📂cache bitrix
|
||||
@@ -0,0 +1,2 @@
|
||||
client 3
|
||||
apache + php container
|
||||
@@ -0,0 +1 @@
|
||||
client...._db
|
||||
@@ -0,0 +1 @@
|
||||
CLEAN_db
|
||||
@@ -0,0 +1 @@
|
||||
client1 apache reverse proxy
|
||||
@@ -0,0 +1 @@
|
||||
docker-compose.yml
|
||||
@@ -0,0 +1 @@
|
||||
client1_db
|
||||
Reference in New Issue
Block a user