diff --git a/src/form/pane.js b/src/form/pane.js index 9c655615..d6e3f784 100644 --- a/src/form/pane.js +++ b/src/form/pane.js @@ -6,6 +6,8 @@ import * as UI from 'solid-ui' import { authn } from 'solid-logic' import * as $rdf from 'rdflib' +import '../styles/formPane.css' + const ns = UI.ns export const formPane = { @@ -27,15 +29,16 @@ export const formPane = { const kb = context.session.store const dom = context.dom - const mention = function complain (message, style) { + const mention = function mention (message, className) { const pre = dom.createElement('p') - pre.setAttribute('style', style || 'color: grey; background-color: white') + pre.classList.add('formPaneMessage') + pre.classList.add(className || 'formPaneMessageInfo') box.appendChild(pre).textContent = message return pre } - const complain = function complain (message, style) { - mention(message, 'style', style || 'color: grey; background-color: #fdd;') + const complain = function complain (message) { + mention(message, 'formPaneMessageError') } const complainIfBad = function (ok, body) { @@ -103,7 +106,7 @@ export const formPane = { complainIfBad ) ) - e.setAttribute('style', 'margin-left: auto; display: block;') + e.classList.add('formPaneEditButton') } } const anchor = dom.createElement('a') diff --git a/src/humanReadablePane.js b/src/humanReadablePane.js index 76109a75..00645881 100644 --- a/src/humanReadablePane.js +++ b/src/humanReadablePane.js @@ -7,6 +7,7 @@ import { icons, ns } from 'solid-ui' import { Util } from 'rdflib' import { marked } from 'marked' import DOMPurify from 'dompurify' +import './styles/humanReadablePane.css' // Helper function to check if a URI has a markdown file extension const isMarkdownFile = (uri) => { @@ -178,6 +179,11 @@ const humanReadablePane = { div.setAttribute('class', 'docView') div.setAttribute('style', 'display: block; width: 100%; max-width: 100%; box-sizing: border-box;') + const setFrameDisplayStyles = function (frame, lines) { + frame.classList.add('doc', 'humanReadableFrame') + frame.style.setProperty('--human-readable-height', `${lines}em`) + } + // render markdown to html in a DIV element const renderMarkdownContent = function (frame) { kb.fetcher.webOperation('GET', subject.uri).then(response => { @@ -216,7 +222,7 @@ const humanReadablePane = { if (isMarkdown) { // For markdown, use a DIV element and render the content - const frame = myDocument.createElement('DIV') + const frame = myDocument.createElement('div') renderMarkdownContent(frame) const frameContainer = myDocument.createElement('div') frameContainer.setAttribute('style', 'display: block; width: 100%; max-width: 100%; box-sizing: border-box;') @@ -232,7 +238,7 @@ const humanReadablePane = { div.appendChild(frameContainer) } else { // For other content types, use IFRAME - const frame = myDocument.createElement('IFRAME') + const frame = myDocument.createElement('iframe') // Apply sandbox for HTML/XHTML if (ct === 'text/html' || ct === 'application/xhtml+xml') { diff --git a/src/pad/padPane.ts b/src/pad/padPane.ts index 1cc12876..645c6ad1 100644 --- a/src/pad/padPane.ts +++ b/src/pad/padPane.ts @@ -394,7 +394,7 @@ const paneDef: PaneDefinition = { // give the user links to the new app const p = div.appendChild(dom.createElement('p')) - p.setAttribute('style', 'font-size: 140%;') + p.classList.add('padPaneSuccess') p.innerHTML = 'Your