Skip to content

Commit

Permalink
Fix textarea and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
javalikescript committed Dec 15, 2024
1 parent 0c27271 commit 92b89f4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 43 deletions.
8 changes: 4 additions & 4 deletions extensions/web-base/addons.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

local function onStartup(extension)
local function onStartup(extension, script)
extension:getEngine():onExtension('web-base', function(webBaseExtension)
webBaseExtension:registerAddonExtension(extension, true)
webBaseExtension:registerAddonExtension(extension, script or true)
end)
end

Expand All @@ -11,9 +11,9 @@ local function onShutdown(extension)
end)
end

local function registerAddonExtension(extension)
local function registerAddonExtension(extension, script)
extension:subscribeEvent('startup', function()
onStartup(extension)
onStartup(extension, script)
end)
extension:subscribeEvent('shutdown', function()
onShutdown(extension)
Expand Down
6 changes: 4 additions & 2 deletions extensions/web-base/www/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,15 @@ section > article > section > ul li textarea {
}

textarea.full {
height: calc(100% - 1rem);
height: calc(100% - 1.5rem);
width: calc(100% - 1rem);
border: none;
margin: 0px;
padding: 0.5rem;
resize: none;
font-size: 2rem;
}
textarea.full:focus {
outline: none;
}

.scrollable {
Expand Down
2 changes: 1 addition & 1 deletion extensions/web-notes/web-note.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
<button v-on:click="app.back()" title="Close"><i class="fa fa-window-close"></i></button>
</template>
<article class="content">
<textarea v-model="text" v-on:keydown.ctrl.s.exact.prevent.stop="onSave()" spellcheck="false" wrap="off" class="full" placeholder="Enter your note here"></textarea>
<textarea v-model="text" v-on:keydown.ctrl.s.exact.prevent.stop="onSave()" spellcheck="false" wrap="off" class="full" style="font-size: 2rem" placeholder="Enter your note here"></textarea>
</article>
</app-page>
51 changes: 15 additions & 36 deletions lha/Engine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -327,53 +327,32 @@ return class.create(function(engine)
self:loadScriptExtensions()
end

function engine:getScriptExtensions()
local scripts = {}
local others = {}
for _, extension in ipairs(self.extensions) do
if extension:getType() == 'script' then
table.insert(scripts, extension)
else
table.insert(others, extension)
end
end
return scripts, others
end

function engine:reloadExtensions(full, excludeScripts)
if excludeScripts then
local scripts, others = self:getScriptExtensions()
if full then
self.extensions = scripts
self:loadOtherExtensions()
else
for _, extension in ipairs(others) do
extension:restartExtension()
end
end
function engine:reloadExtensions(full)
if full then
self.extensions = List.filter(self.extensions, function(extension)
return extension:getType() == 'script'
end)
self:loadOtherExtensions()
else
if full then
self:publishEvent('shutdown')
self:loadExtensions()
self:publishEvent('startup')
self:publishEvent('configuration')
self:publishEvent('things')
else
for _, extension in ipairs(self.extensions) do
for _, extension in ipairs(self.extensions) do
if extension:getType() ~= 'script' then
extension:restartExtension()
end
end
end
end

function engine:reloadScripts(full)
local scripts, others = self:getScriptExtensions()
if full then
self.extensions = others
self.extensions = List.filter(self.extensions, function(extension)
return extension:getType() ~= 'script'
end)
self:loadScriptExtensions()
else
for _, extension in ipairs(scripts) do
extension:restartExtension()
for _, extension in ipairs(self.extensions) do
if extension:getType() == 'script' then
extension:restartExtension()
end
end
end
end
Expand Down

0 comments on commit 92b89f4

Please sign in to comment.