Skip to content

Commit

Permalink
wip fix changes check
Browse files Browse the repository at this point in the history
  • Loading branch information
heapwolf committed Apr 6, 2024
1 parent ef41021 commit 3d35804
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
15 changes: 14 additions & 1 deletion src/components/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class EditorTabs extends Tonic {
label: node.label,
id: node.id,
path: node.id,
isReadOnly: node.isReadOnly,
isRootSettingsFile: node.isRootSettingsFile,
model: monaco.editor.createModel(),
state: null,
Expand Down Expand Up @@ -318,7 +319,17 @@ class AppEditor extends Tonic {
const mappings = app.state.settings.extensionLanguageMappings
const lang = mappings[ext] || ext.slice(1)
monaco.editor.setModelLanguage(this.editor.getModel(), lang)
let data = projectNode.value || await fs.promises.readFile(projectNode.id, 'utf8')

let data = projectNode.value

if (!data && projectNode.id) {
try {
data = await fs.promises.readFile(projectNode.id, 'utf8')
} catch (err) {
console.error(err)
return
}
}

if (path.extname(projectNode.id) === '.json') {
try {
Expand Down Expand Up @@ -462,6 +473,8 @@ class AppEditor extends Tonic {
const value = this.editor.getValue()
const app = this.props.parent

if (tab.isReadyOnly) return

if (app.state.settings.previewMode) {
this.saveCurrentTab()
return
Expand Down
4 changes: 3 additions & 1 deletion src/components/patch-requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ class PatchRequests extends Tonic {
const app = this.props.app
const bundleId = app.state.currentProject.bundleId

const { data: dataPatches } = await app.db.patches.readAll({ gte: bundleId, lte: bundleId + '~' })
const opts = { lt: bundleId.slice(0, -1) + '\xFF', gt: bundleId }

const { data: dataPatches } = await app.db.patches.readAll(opts)

const patches = []

Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ class AppView extends Tonic {
title: preview.title,
titleBarStyle: preview.titleBarStyle, // ie 'hiddenInset'
trafficLightPosition: preview.trafficLightPosition, // ie '10x26'
backgroundColorDark: 'rgba(46, 46, 46, 1)',
backgroundColorLight: 'rgba(255, 255, 255, 1)',
backgroundColorDark: 'rgba(46, 46, 46, 0.1)',
backgroundColorLight: 'rgba(255, 255, 255, 0.1)',
aspectRatio: preview.aspectRatio, // ie '9:19.5'
width: Math.floor(width / scale),
height: Math.floor(height / scale)
Expand Down

0 comments on commit 3d35804

Please sign in to comment.