Skip to content

Commit

Permalink
Uploads for 0.0.8 compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelNivard authored Nov 18, 2024
1 parent fa8bee5 commit 3d31fb6
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 43 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"id":"ridian","name":"Ridian","version":"0.0.7","minAppVersion":"0.15.0","description":"Execute R code blocks and display outputs and plots & render documents with Quarto within Obsidian.","author":"Michel Nivard","authorUrl":"https://github.com/MichelNivard/Ridian","isDesktopOnly":true}
{"id":"ridian","name":"Ridian","version":"0.0.8","minAppVersion":"0.15.0","description":"Execute R code blocks and display outputs and plots & render documents with Quarto within Obsidian.","author":"Michel Nivard","isDesktopOnly":true}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Ridian",
"version": "0.0.7",
"version": "0.0.8",
"description": "Execute R code blocks and display outputs and plots within Obsidian.",
"main": "main.js",
"scripts": {
Expand Down
6 changes: 4 additions & 2 deletions src/CombinedPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export default class CombinedPlugin extends Plugin {

async onload() {
console.log('Loading Combined Plugin');
// Apply wider code chunks
document.body.setAttribute('ridian', 'true');

await this.loadSettings();
setupPathEnvironment();
Expand All @@ -42,6 +44,8 @@ export default class CombinedPlugin extends Plugin {

onunload() {
console.log('Unloading Combined Plugin');
// Apply wider
document.body.removeAttribute('ridian');

this.floatingMenu.onUnload();

Expand All @@ -50,7 +54,6 @@ export default class CombinedPlugin extends Plugin {
});
this.rProcesses.clear();

this.detachViews();

console.log('Combined Plugin unloaded successfully');
}
Expand Down Expand Up @@ -237,7 +240,6 @@ export default class CombinedPlugin extends Plugin {
// Method to run commands from the floating menu
public runCommand(commandId: string) {
const fullCommandId = `ridian:${commandId}`;
console.log(`Executing command: ${fullCommandId}`);
(this.app as any).commands.executeCommandById(fullCommandId);
//(this.app as any).commands.executeCommandById(commandId);
//this.app.commands.executeCommandById(commandId)
Expand Down
18 changes: 9 additions & 9 deletions src/FloatingMenu.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// src/FloatingMenu.ts

import { Plugin, MarkdownView, setIcon } from 'obsidian';
import { Plugin, MarkdownView, setIcon,setTooltip } from 'obsidian';
import CombinedPlugin from './CombinedPlugin';

export class FloatingMenu {
Expand Down Expand Up @@ -50,9 +50,9 @@ export class FloatingMenu {
const strikethroughButton = this.createIconButton('strikethrough', () => this.plugin.applyWrapping('~~'), 'Strikethrough');
const underlineButton = this.createIconButton('underline', () => this.plugin.applyHtmlTag('u'), 'Underline');

const alignLeftButton = this.createTextButton('align-left', '', () => this.plugin.applyAlignment('left'), 'Left Align');
const alignCenterButton = this.createTextButton('align-center', '', () => this.plugin.applyAlignment('center'), 'Center Align');
const alignRightButton = this.createTextButton('align-right', '', () => this.plugin.applyAlignment('right'), 'Right Align');
const alignLeftButton = this.createTextButton('align-left', '', () => this.plugin.applyAlignment('left'), 'Left align');
const alignCenterButton = this.createTextButton('align-center', '', () => this.plugin.applyAlignment('center'), 'Center align');
const alignRightButton = this.createTextButton('align-right', '', () => this.plugin.applyAlignment('right'), 'Right align');
const alignJustifyButton = this.createTextButton('align-justify', '', () => this.plugin.applyAlignment('justify'), 'Justify');

const h1Button = this.createIconButton('heading-1', () => this.plugin.applyHeading(1), 'Heading 1');
Expand All @@ -63,16 +63,16 @@ export class FloatingMenu {

const runChunkButton = this.createTextButton(
'play',
'Run Chunk',
'Run chunk',
() => this.plugin.runCommand('run-current-code-chunk'),
'Run Current Code Chunk'
'Run current code chunk'
);

const exportNoteButton = this.createTextButton(
'file-down',
'Render/Quarto',
() => this.plugin.runCommand('export-note-with-quarto'),
'Export Note with Quarto'
'Export note with Quarto'
);

// Apply styles if needed
Expand Down Expand Up @@ -108,7 +108,7 @@ export class FloatingMenu {
button.className = 'floating-menu-button';
setIcon(button, iconId);
if (tooltip) {
button.setAttribute('aria-label', tooltip);
setTooltip(button, tooltip);
button.setAttribute('title', tooltip);
}
button.addEventListener('click', onClick);
Expand All @@ -131,7 +131,7 @@ export class FloatingMenu {
button.appendChild(textSpan);

if (tooltip) {
button.setAttribute('aria-label', tooltip);
setTooltip(button, tooltip);
button.setAttribute('title', tooltip);
}

Expand Down
10 changes: 5 additions & 5 deletions src/PathUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// src/PathUtils.ts

import { Platform } from "obsidian";
import { execSync } from 'child_process';
import * as process from 'process';
import * as fs from 'fs';
Expand All @@ -8,11 +8,11 @@ import * as path from 'path';
export function setupPathEnvironment() {
process.env.PATH = getUserShellPath();

if (process.platform === 'darwin') {
if (Platform.isMacOS) {
process.env.PATH += ':/usr/local/bin:/opt/homebrew/bin';
} else if (process.platform === 'linux') {
} else if (Platform.isLinux) {
process.env.PATH += ':/usr/local/bin';
} else if (process.platform === 'win32') {
} else if (Platform.isWin) {
// Windows-specific PATH setup
const programFiles = process.env.ProgramFiles || 'C:\\Program Files';
const programFilesX86 = process.env['ProgramFiles(x86)'] || 'C:\\Program Files (x86)';
Expand Down Expand Up @@ -69,7 +69,7 @@ export function setupPathEnvironment() {


function getUserShellPath(): string {
if (process.platform === 'win32') {
if (Platform.isWin) {
// On Windows, use process.env.PATH directly
return process.env.PATH || '';
} else {
Expand Down
4 changes: 1 addition & 3 deletions src/RCodeEvaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,7 @@ cat("\\n${marker}\\n")

if (isHelpRequest) {
try {
console.log('Temporary Directory:', tempDir);
console.log('Help File Path:', tempHelpFilePath);
console.log('Help File Path for R:', tempHelpFilePathR);



// Check if the help file exists
Expand Down
7 changes: 0 additions & 7 deletions src/SettingsTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export class MyPluginSettingTab extends PluginSettingTab {

containerEl.empty();

containerEl.createEl('h2', { text: 'R Integration Settings' });

new Setting(containerEl)
.setName('Path to R Executable')
.setDesc('Specify the path to your R executable.')
Expand All @@ -42,7 +40,6 @@ export class MyPluginSettingTab extends PluginSettingTab {
.onChange(async (value) => {
this.plugin.settings.rExecutablePath = value.trim();
await this.plugin.saveSettings();
new Notice('R executable path updated successfully.');
})
);

Expand All @@ -56,7 +53,6 @@ export class MyPluginSettingTab extends PluginSettingTab {
.onChange(async (value) => {
this.plugin.settings.rstudioPandocPath = value.trim();
await this.plugin.saveSettings();
new Notice('RStudio Pandoc path updated successfully.');
})
);

Expand All @@ -70,7 +66,6 @@ export class MyPluginSettingTab extends PluginSettingTab {
.onChange(async (value) => {
this.plugin.settings.quartoExecutablePath = value.trim();
await this.plugin.saveSettings();
new Notice('Quarto executable path updated successfully.');
})
);

Expand All @@ -83,10 +78,8 @@ export class MyPluginSettingTab extends PluginSettingTab {
await this.plugin.saveSettings();
if (value) {
this.plugin.floatingMenu.onLoad();
new Notice('Floating Menu Enabled.');
} else {
this.plugin.floatingMenu.onUnload();
new Notice('Floating Menu Disabled.');
}
})
);
Expand Down
16 changes: 2 additions & 14 deletions styles.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@

/* Additional Custom R Run Button Styles */

body {
body[ridian] {
--file-line-width: 800px;
}

.readable.markdown-preview-view.is-readable-line-width .markdown-preview-sizer,
.readable.is-live-preview.is-readable-line-width .cm-sizer,
.readable.markdown-preview-view .markdown-preview-sizer,
.readable.is-live-preview .cm-sizer {
max-width: 800px; /* adjust according to preference */
margin-left: auto;
margin-right: auto;
}


.r-run-button {
position: absolute;
top: 5px;
Expand All @@ -26,8 +16,7 @@ margin-right: auto;
background-color: #e0e0e0;
}

.HyperMD-codeblock.HyperMD-codeblock-bg.cm-line {
width: 800px;
.HyperMD-codeblock.HyperMD-codeblock-bg.cm-line[ridian] {
max-width: 800px !important
}

Expand All @@ -43,7 +32,6 @@ margin-right: auto;
.callout[data-callout="output"] {
background-color: var(--background-primary);
border-left: 3px solid var(--color-accent);
width: 800px;
max-width: 800px;
}

Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"0.0.7": "0.15.0"
"0.0.8": "0.15.0"
}

0 comments on commit 3d31fb6

Please sign in to comment.