Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Improve iframe behavior #45

Merged
merged 5 commits into from Mar 10, 2017
Merged

Improve iframe behavior #45

merged 5 commits into from Mar 10, 2017

Conversation

gyoshev
Copy link
Contributor

@gyoshev gyoshev commented Mar 7, 2017

This PR resolves two problems:

  • iframe height is polled at all times, deteriorating performance of all widgets
  • iframes do not have an ID that can be used for snapshots and tests

After merging, the height and IDs can be modified via snippet metadata. The default height of snippets is now 280px, and the iframe id is inferred by the previous heading in the document, prefixed with example-. For example, "Basic Usage" implies that the next snippet will have id="example-basic-usage"

If a document heading changes, and there is a snippet after it, it would be nice to keep the old id after the change:

Before:

# Basic Usage

```ts
code
```

After:

 # Completely different title

 {% meta id:example-basic-usage %}
 ```ts
 code
 ```
 {% endmeta %}

/cc @ipeshev @yordanov @dmihaylo

removes polling for changes, which will make the demos more snappy

see https://github.com/telerik/k2-site/blob/master/README.md#snippet-metadata for more information how to set the snippet height
allows iframes to be efficiently targeted for testing
@gyoshev gyoshev requested a review from tsvetomir March 7, 2017 09:43
@gyoshev gyoshev requested a review from Raisolution March 7, 2017 11:44
Copy link
Member

@tsvetomir tsvetomir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One hack less 🎉

@gyoshev gyoshev merged commit 5ca376d into master Mar 10, 2017
@gyoshev gyoshev deleted the fixed-runner-height branch March 10, 2017 09:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants