-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve mail partial lookup method
- Loading branch information
Samuel Georges
committed
Jul 22, 2017
1 parent
e302c6c
commit 5d64a14
Showing
14 changed files
with
156 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,37 @@ | ||
var previewIframe | ||
|
||
$(document).on('change', '.field-colorpicker', function() { | ||
$('#brandSettingsForm').request('onRefresh', { | ||
data: { 'fields': ['_mail_preview'] } | ||
$('#brandSettingsForm').request('onUpdateSampleMessage').done(function(data) { | ||
updatePreviewContent(data.previewHtml) | ||
}) | ||
}) | ||
|
||
function createPreviewContainer(el, content) { | ||
var newiframe | ||
|
||
// Shadow DOM ignores media queries | ||
// if (document.body.attachShadow) { | ||
if (false) { | ||
var shadow = el.attachShadow({ mode: 'open' }) | ||
shadow.innerHTML = content | ||
} | ||
else { | ||
newiframe = document.createElement('iframe') | ||
function updatePreviewContent(content) { | ||
'srcdoc' in previewIframe | ||
? previewIframe.srcdoc = content | ||
: previewIframe.src = 'data:text/html;charset=UTF-8,' + content | ||
} | ||
|
||
'srcdoc' in newiframe | ||
? newiframe.srcdoc = content | ||
: newiframe.src = 'data:text/html;charset=UTF-8,' + content | ||
function adjustPreviewHeight() { | ||
previewIframe.style.height = (previewIframe.contentWindow.document.getElementsByTagName('body')[0].scrollHeight) +'px' | ||
} | ||
|
||
var parent = el.parentNode | ||
parent.replaceChild(newiframe, el) | ||
function createPreviewContainer(el, content) { | ||
previewIframe = document.createElement('iframe') | ||
|
||
newiframe.style.width = '100%' | ||
newiframe.setAttribute('frameborder', 0) | ||
updatePreviewContent(content) | ||
|
||
newiframe.onload = adjustIframeHeight | ||
} | ||
previewIframe.style.width = '100%' | ||
previewIframe.setAttribute('frameborder', 0) | ||
previewIframe.setAttribute('id', el.id) | ||
previewIframe.onload = adjustPreviewHeight | ||
|
||
function adjustIframeHeight() { | ||
newiframe.style.height = '500px' | ||
newiframe.style.height = 1 + (newiframe.contentWindow.document.getElementsByTagName('body')[0].scrollHeight) +'px' | ||
} | ||
var parent = el.parentNode | ||
parent.replaceChild(previewIframe, el) | ||
|
||
$(document).render(adjustIframeHeight) | ||
$(window).resize(adjustIframeHeight) | ||
/* | ||
* Auto adjust height | ||
*/ | ||
$(document).render(adjustPreviewHeight) | ||
$(window).resize(adjustPreviewHeight) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name = "Footer" | ||
== | ||
------------------- | ||
{{ body }} | ||
== | ||
<tr> | ||
<td> | ||
<table class="footer" align="center" width="570" cellpadding="0" cellspacing="0"> | ||
<tr> | ||
<td class="content-cell" align="center"> | ||
{{ body|md }} | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name = "Header" | ||
== | ||
*** {{ body }} <{{ url }}> | ||
== | ||
<tr> | ||
<td class="header"> | ||
{% if url %} | ||
<a href="{{ url }}"> | ||
{{ body }} | ||
</a> | ||
{% else %} | ||
<span> | ||
{{ body }} | ||
</span> | ||
{% endif %} | ||
</td> | ||
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name = "Panel" | ||
== | ||
{{ body }} | ||
== | ||
<table class="panel" width="100%" cellpadding="0" cellspacing="0"> | ||
<tr> | ||
<td class="panel-content"> | ||
<table width="100%" cellpadding="0" cellspacing="0"> | ||
<tr> | ||
<td class="panel-item"> | ||
{{ body|md }} | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name = "Promotion" | ||
== | ||
{{ body }} | ||
== | ||
<table class="promotion" align="center" width="100%" cellpadding="0" cellspacing="0"> | ||
<tr> | ||
<td align="center"> | ||
{{ body|md }} | ||
</td> | ||
</tr> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<table class="subcopy" width="100%" cellpadding="0" cellspacing="0"> | ||
<tr> | ||
<td> | ||
{{ body|md }} | ||
</td> | ||
</tr> | ||
</table> |