mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-06 03:14:39 +08:00
fix(examples): Small fixes to QuickSchedule plugin
This commit is contained in:
parent
f3d58aaede
commit
589972c555
2 changed files with 23 additions and 16 deletions
|
@ -5,11 +5,11 @@
|
||||||
<title></title>
|
<title></title>
|
||||||
<link rel='stylesheet' href='bootstrap.min.css'/>
|
<link rel='stylesheet' href='bootstrap.min.css'/>
|
||||||
<link rel='stylesheet' href='fullcalendar/fullcalendar.css'/>
|
<link rel='stylesheet' href='fullcalendar/fullcalendar.css'/>
|
||||||
<script src='nylas://N1-Quick-Schedule/fullcalendar/lib/jquery.min.js'></script>
|
<script src='fullcalendar/lib/jquery.min.js'></script>
|
||||||
<script src='nylas://N1-Quick-Schedule/fullcalendar/lib/moment.min.js'></script>
|
<script src='fullcalendar/lib/moment.min.js'></script>
|
||||||
<script src='nylas://N1-Quick-Schedule/fullcalendar/lib/moment-timezone-with-data.min.js'></script>
|
<script src='fullcalendar/lib/moment-timezone-with-data.min.js'></script>
|
||||||
<script src='nylas://N1-Quick-Schedule/fullcalendar/fullcalendar.js'></script>
|
<script src='fullcalendar/fullcalendar.js'></script>
|
||||||
<script src='nylas://N1-Quick-Schedule/bootstrap.min.js'></script>
|
<script src='bootstrap.min.js'></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
|
@ -77,15 +77,21 @@ module.exports =
|
||||||
# `DraftStoreExtension`.
|
# `DraftStoreExtension`.
|
||||||
DraftStore.registerExtension AvailabilityDraftExtension
|
DraftStore.registerExtension AvailabilityDraftExtension
|
||||||
|
|
||||||
# Subscribe to the ipc event `fromRenderer`, which will be published
|
# Register a protocol that allows the calendar window to pass data back to the plugin
|
||||||
# elsewhere in the package.
|
# with web requests
|
||||||
protocol.registerStringProtocol 'quick-schedule', (request, callback) =>
|
if NylasEnv.isMainWindow()
|
||||||
{host:event,query:rawQuery} = url.parse(request.url)
|
# First unregister the protocol, in case it has already been registered with a callback that's no
|
||||||
stringArgs = qs.parse(rawQuery)
|
# longer valid (e.g. if the main window has reloaded). If the protocol is not registered, this line
|
||||||
data = {}
|
# does nothing.
|
||||||
for own k,v of stringArgs
|
protocol.unregisterProtocol('quick-schedule')
|
||||||
data[k] = JSON.parse(v)
|
# Now register the new protocol
|
||||||
response = @_onCalendarEvent(event,data,callback)
|
protocol.registerStringProtocol 'quick-schedule', (request, callback) =>
|
||||||
|
{host:event,query:rawQuery} = url.parse(request.url)
|
||||||
|
stringArgs = qs.parse(rawQuery)
|
||||||
|
data = {}
|
||||||
|
for own k,v of stringArgs
|
||||||
|
data[k] = JSON.parse(v)
|
||||||
|
response = @_onCalendarEvent(event,data,callback)
|
||||||
|
|
||||||
# Serialize is called when your package is about to be unmounted.
|
# Serialize is called when your package is about to be unmounted.
|
||||||
# You can return a state object that will be passed back to your package
|
# You can return a state object that will be passed back to your package
|
||||||
|
@ -100,8 +106,9 @@ module.exports =
|
||||||
#
|
#
|
||||||
deactivate: ->
|
deactivate: ->
|
||||||
ComponentRegistry.unregister CalendarButton
|
ComponentRegistry.unregister CalendarButton
|
||||||
DraftStore.unregister AvailabilityDraftExtension
|
DraftStore.unregisterExtension AvailabilityDraftExtension
|
||||||
protocol.unregisterProtocol('quick-schedule')
|
if NylasEnv.isMainWindow()
|
||||||
|
protocol.unregisterProtocol('quick-schedule')
|
||||||
|
|
||||||
### Internal Methods ###
|
### Internal Methods ###
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue